PrimarySpatialRectSearch Command

Use the PrimarySpatialRectSearch command in a Logic Template to search a primary spatial index for records containing coordinates that lie within any of the spatial grid rectangles that are touched by the rectangular area being searched. To obtain exact results, the records returned by the search request should then be filtered by the SpatialRectFilter command.

Only the PrimarySpatialRadialSearch or the PrimarySpatialRectSearch commands can be used to search a primary spatial index. And, only a primary spatial index should be searched using the PrimarySpatialRadialSearch or the PrimarySpatialRectSearch command.

The results from the search of all primary indexes within a single pass are ORed together, then used to restrict the overall search results from that pass in a highly optimized manner. The restricted results from the current pass are then ORed to the results from all other passes.

To execute a Search Primary Spatial Index Rectangular request, use the PrimarySpatialRectSearch command with three arguments:

PrimarySpatialRectSearch( idx, rect, pas );

PrimarySpatialRectSearch Arguments

Argument

Description

idx

The primary spatial index to be searched.

rect

The name of the HTML variable containing the coordinates of two diagonally opposing corners of the rectangle.

pas

The pass during which the search is to be executed.

Access the PrimarySpatialRectSearch Dialog Box by selecting the Spatial Index->Primary Rectangular menu item under the Searching category of the Logic Template editor command menu.

Examples

Command

Description

PrimarySpatialRectSearch( AreaIndex, Rectangle, 1 );

Search primary spatial index named "AreaIndex" during pass 1. Use the coordinates of the two diagonally opposing corners stored in the HTML variable "Rectangle" to define the rectangle and OR the results with other indexes.

Rectangle = {{43, 55}, {48, 59}};

PrimarySpatialRectSearch( AreaIndex, Rectangle, 3 );

Search prmary spatial index named "AreaIndex" during pass 3. Search for records within a rectangle defined by the two diagonally opposing corners with coordinates { 43, 55 } and { 48, 59 }, and AND the results with other indexes.

IF ( NWcorner && SEcorner )

Rectangle = {NWcorner, SEcorner};

PrimarySpatialRectSearch( AreaIndex, Rectangle, 1 );

ENDIF

If the HTML variables "NWcorner" and "SEcorner" are defined, search the primary spatial index named "AreaIndex" during pass 1 for the rectangle defined by the two HTML variables and OR the results to other indexes.