Spatial query

A spatial query is a special type of database query supported by geodatabases and spatial databases. The queries differ from non-spatial 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.

Types of queries

The function names for queries differ across geodatabases. The following list contains commonly used functions built into PostGIS, 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
  • Centroid(geometry) : geometry
gollark: Everything rarer: NOPE!
gollark: I can basically only catch the occasional unbreedable.
gollark: How do you people catch such gorvy things?
gollark: It took me hours to even get a generic hatchling for one. If you have a more specific request you may get it though.
gollark: Unless God-Emperor TJ09 develops sanity and common sense.

See also


This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.