Spatial functions

Use specific spatial data type functions to perform operations on spatial data.

Spatial data type functions can perform the following types of operations on spatial data:
  • Determine spatial relationships: You can determine whether a specific relationship exists between a pair of geometries.

    The distance that separates a hazardous waste disposal site and a school is an example of a spatial relationship.

  • Produce a new geometry: You can compare two existing geometries and return a new geometry that is based on how the two geometries are related.

    For example, the ST_Difference() function returns that portion of the first geometry that is not intersected or overlapped by the second.

  • Transform geometries: You can generate a new geometry from an existing geometry and a formula.

Functions can compare two geometries if the SRIDs of the arguments are the same. To compare two geometries that have different SRIDs, use the ST_Transform() function to transform one of the geometries.

The Dimensionally Extended 9 Intersection Model (DE-9IM) is a mathematical approach that defines the pair-wise spatial relationship between geometries of different types and dimensions.

Most spatial data functions are compliant with OpenGIS and ISO/SQLMM standards and have the prefix ST_. Some spatial data functions extend the OpenGIS and ISO/SQLMM standards and have the prefix SE_.

The following OpenGIS and ISO/SQLMM-compliant functions replace deprecated functions that extend the standards:
Table 1. Compliant functions that replace extension functions

Compliant function Extension function
ST_Is3D() SE_Is3D()
ST_IsMeasured() SE_IsMeasured()
ST_LocateAlong() SE_LocateAlong()
ST_LocateBetween() SE_LocateBetween()
ST_M() SE_M()
ST_Z() SE_Z()
ST_MaxM() SE_MMax()
ST_MinM() SE_MMin()
ST_MaxX() SE_XMax()
ST_MinX() SE_XMin()
ST_MaxY() SE_YMax()
ST_MinY() SE_YMin()
ST_MaxZ() SE_ZMax()
ST_MaxZ() SE_ZMin()