Spatial selection and spatial queries

Navigation:  Building Blocks of Spatial Analysis > Queries, Computations and Density >

Spatial selection and spatial queries

Previous pageReturn to chapter overviewNext page

As with many other terms, the expression “spatial query” means different things to different suppliers. In the majority of cases it refers to the process of selecting information (features and associated attribute data in tables) by some form of query operation that includes a spatial constraint. For example: SELECT all features WITHIN a specified radius of a specified point; or SELECT all point objects that fall WITHIN a specific polygon. For most (all) GIS packages this selection process can be achieved by a point-and-click visual interface, subject to certain selection rules. In parallel there is the option to execute a single command or series of commands as a script or program, or as a form of extended SQL query. The result of such queries may be a new table and feature set, which can be viewed, analyzed further or saved for additional analysis. Raster-based GIS packages do not generally support spatial query operations, although they may support standard SQL queries on attribute data. The various approaches are best understood by describing a number of specific implementations:

ArcGIS provides full support for standard SQL SELECT queries, such as: SELECT <all polygons in a given layer> WHERE <attribute table field> EQUALS <value>. It does not appear to support other forms of SQL query, such as MAKE TABLE, UPDATE or DELETE. It supports JOIN and RELATE operations between attribute tables based on specific fields, but it also provides spatial extensions to the JOIN and RELATE process enabling tables to be joined and queried based on their relative locations. Where joins are based on spatial location, data from one set of features are incorporated into the attribute table of the other set of features according to selectable rules. The ArcMAP visual interface provides a “Select by location” facility with selection qualified by a variety of spatial conditions (applicable to point, line and polygon features where meaningful): Intersect; Are within a distance of; Completely contain; Are completely within; Have their center in; Share a line segment with; Touch the boundary of; Are identical to; Are crossed by the outline of; Contain; Are contained by. Each of the options may be further modified by selecting a tolerance level (a buffer — see further Section 4.4.4, Buffering) around the points, lines or polygons in question.

Manifold provides support for specific spatial extensions to the standard SQL syntax. This enables a very large range of operations to be carried out, including so-called Action Queries (e.g. queries that CREATE, UPDATE and DELETE table data). Example spatial extensions that result in true or false being returned include: Adjacent, Contains, Intersection, IsArea/IsLine/IsPoint and Touches. These operations may be combined with other spatial operations (such as distance and buffer functions) to select records, and may also be combined with operators that generate spatial objects (e.g. a triangulation or convex hull of a point set) rather than simply selecting or amending existing objects. As such many of Manifold’s spatial query functions are an extension of its “Transform” facilities, performing geometrical processing on the selected data as well as simply selecting items.

MapInfo, like ArcGIS, provides a range of SQL SELECT facilities and support for spatial joins. Spatial join operators supported include: Contains (A contains at least the other object, B’s centroid), Contains Entire (A contains whole object B), Within (as per Contain, but A and B roles are reversed), Entirely within, and Intersects (A and B have at least one point in common). These operators enable attribute tables to be JOINed without sharing a common field (i.e. a spatial join only).