Spatial query
Encyclopedia
A spatial query is a special type of database query supported by geodatabase
s and spatial database
s. The queries differ from SQL
queries in several important ways. Two of the most important are that they allow for the use of geometry data types such as points, lines and polygons and that these queries consider the spatial relationship between these geometries.
, a free geodatabase which is a PostgreSQL extension (the term 'geometry' refers to a point, line, box or other two or three dimensional shape):
Function prototype: functionName (parameter(s)) : return type
Geodatabase
A geodatabase is a spatial database designed to store, query, and manipulate geographic information and spatial data of low dimensionality. It is a specialized type of spatial database often with optimizations for 2 and 3 dimensions, raster data and Euclidean distance.Within a spatial database,...
s and spatial database
Spatial Database
A spatial database is a database that is optimized to store and query data that is related to objects in space, including points, lines and polygons. While typical databases can understand various numeric and character types of data, additional functionality needs to be added for databases to...
s. The queries differ from SQL
SQL
SQL is a programming language designed for managing data in relational database management systems ....
queries in several important ways. Two of the most important are that they allow for the use of geometry data types such as points, lines and polygons and that these queries consider the spatial relationship between these geometries.
Types of queries
The function names for queries differ across geodatabases. The following list contains commonly used functions built into PostGISPostGIS
PostGIS is an open source software program that adds support for geographic objects to the PostgreSQL object-relational database. PostGIS follows the Simple Features for SQL specification from the Open Geospatial Consortium .-Features:...
, a free geodatabase which is a PostgreSQL extension (the term 'geometry' refers to a point, line, box or other two or three dimensional shape):
Function prototype: functionName (parameter(s)) : return type
- Distance(geometry, geometry) : number
- Equals(geometry, geometry) : boolean
- Disjoint(geometry, geometry) : boolean
- Intersects(geometry, geometry) : boolean
- Touches(geometry, geometry) : boolean
- Crosses(geometry, geometry) : boolean
- Overlaps(geometry, geometry) : boolean
- Contains(geometry, geometry) : boolean
- Length(geometry) : number
- Area(geometry) : number
- CentroidCentroidIn geometry, the centroid, geometric center, or barycenter of a plane figure or two-dimensional shape X is the intersection of all straight lines that divide X into two parts of equal moment about the line. Informally, it is the "average" of all points of X...
(geometry) : geometry