109 - Compare and contrast attribute query and spatial query

Compare and contrast attribute query and spatial query

Concepts

  • [AM2-3] Spatial queries
    When exploring a spatial data set, the first thing one usually wants to do is select certain features, to (temporarily) restrict the exploration. Such selections can be made on geometric/spatial grounds or on the basis of attribute data associated with the spatial features. Selection conditions on attribute values can be combined using logical connectives such as AND, OR and NOT. Other techniques of selecting features can also usually be combined. Any set of selected features can be used as the input for a subsequent selection procedure. This means, for instance, that we can select all medical clinics first, then identify roads within 200 m of them, then select from those only the major roads, then select the nearest clinics to these remaining roads as the ones that should receive our financial support for maintenance. In this way, we are combining various techniques of selection. Interactive Spatial Selection In interactive spatial selection, one defines the selection condition by pointing at or drawing spatial objects on the screen display, after having indicated the spatial data layer(s) from which to select features. The interactively defined objects are called the selection objects; they can be points, lines, or polygons. The GIS then selects the features in the indicated data layer(s) that overlap (i.e. intersect, meet, contain, or are contained in;) with the selection objects. These become the selected objects. Interactive spatial selection answers questions like “What is at …?” A spatial DBMS provides support for geographic coordinate systems and transformations. It will also provide storage of the relationships between features, including the creation and storage of topological relationships. As a result, one is able to use functions for “spatial query” (exploring spatial relationships). To illustrate, a spatial query using SQL to find all the Thai restaurants within 2 km of a given hotel would look like: SELECT R.Name FROM Restaurants AS R, Hotels as H WHERE R.Type = Thai AND H.name = Hilton AND Intersect(R.Geometry, Buffer(H.Geometry, 2)) The Intersect command creates a spatial join between restaurants and hotels. The Geometry column carries the spatial data. It is likely that in the near future all spatial data will be stored directly in spatial databases.