At present, the query function of most mature commercial GIS software can perfectly realize the simple search of spatial entity. For example, according to the spatial position indicated by the mouse, the system can find out the spatial entity and spatial range of the location (composed of several spatial entities) as well as their attributes, and display the list of attributes of the spatial object, and can carry out related work. Statistical analysis. The query can be divided into two steps: firstly, by means of spatial index, the selected spatial entity can be quickly retrieved in the spatial database. Secondly, according to the connection of spatial data and attribute data, the attribute list of the spatial entity can be obtained. Generally speaking, the query operation based on attribute information is mainly completed in attribute database. At present, most GIS software stores attribute information in relational database, and the mature relational database provides us with a complete data index method and information query means. Almost all relational database management systems support standard structured query languages. Using SQL, we can easily realize the compound condition query of attribute information in the attribute database, screen out the identification value of the spatial entity that meets the condition, and then retrieve the spatial entity in the spatial database according to the identification value. There are many spatial relationships among spatial entities (including topology, order, measurement, etc.). In the actual application process, users often hope that GIS can provide some functions that can directly calculate spatial entity relations, such as users want to query cities that meet the following conditions: A is east of a certain railway; B is within 30 kilometers of the railway; The population of City C is more than 700,000; The selected area of City D is a defined polygon. The entire query calculation involves spatial ordinal relationships (east of the railway), spatial distance relationships (no more than 30 kilometers from the railway), spatial topological relationships (the selected cities are within the defined area), as well as attribute information queries (city population greater than 700,000). As far as the current mature geographic information system is concerned, it is difficult to complete the above query tasks systematically. For this reason, many geographic information system experts have proposed Spatial Query Language as a solution to the problem, but it is still in the stage of theoretical development and technological exploration. Query and retrieval are among the most frequently used functions in geographic information systems, and most questions raised by GIS users can be expressed as queries. Spatial query languages not only enable convenient access, querying, and processing of spatial data but also ensure the security and integrity control of spatial data. Compared to standard SQL, spatially extended SQL primarily introduces spatial data types and spatial operators to support queries for spatial features. Spatial features include both spatial and non-spatial attributes, with spatial attributes represented by a specific “Location” field. In addition to basic data types such as integer, real, and string, spatial data types also include point, arc, unclosed line, polygon, image, and complex spatial feature types, all of which pertain to the “Location” field. In GeoSQL, spatial operators are parameterized functions that typically take spatial features as input and return either spatial features or numerical values. Spatial operators are mainly divided into two categories: unary spatial operators and binary spatial operators. The general form of standard SQL is typically Fig. 109 The implementation process of GeoSQL # Attribute-based feature query #
Queries Based on Spatial Relations and Attribute Characteristics (SQL) #
GeoSQL: A Spatial Extended SQL Query Language #
SELECT…FROM…WHERE
, which corresponds to the relational operations of projection, Cartesian product, and selection, respectively. Here, the FROM clause represents the Cartesian product of the given relations, effectively defining a single relation. Both the selection in the WHERE clause and the projection in the SELECT clause operate on this relation. Although GeoSQL is a non-procedural textual language, it can incorporate features of visual query languages to simplify and facilitate operations, such as using icons, list boxes, and other components to minimize user text input, while also preventing syntax errors caused by lapses in memory or semantic misunderstandings during input. The implementation process of GeoSQL is illustrated in Figure 7-23.