Geospatial functions

Geospatial functions operate on GEOGRAPHY and GEOMETRY and convert GEOGRAPHY and GEOMETRY values to and from other representations (such as VARCHAR).

Sub-categoryFunctionNotes
Conversion / Input / ParsingST_GEOGFROMGEOHASHGEOGRAPHY only
ST_GEOGPOINTFROMGEOHASHGEOGRAPHY only
ST_GEOGRAPHYFROMWKBGEOGRAPHY only
ST_GEOGRAPHYFROMWKTGEOGRAPHY only
ST_GEOMETRYFROMWKBGEOMETRY only
ST_GEOMETRYFROMWKTGEOMETRY only
ST_GEOMFROMGEOHASHGEOMETRY only
ST_GEOMPOINTFROMGEOHASHGEOMETRY only
TO_GEOGRAPHYGEOGRAPHY only
TO_GEOMETRYGEOMETRY only
TRY_TO_GEOGRAPHYGEOGRAPHY only
TRY_TO_GEOMETRYGEOMETRY only
Conversion / Output / FormattingST_ASGEOJSON
ST_ASWKB
ST_ASBINARYAlias for ST_ASWKB
ST_ASEWKB
ST_ASWKT
ST_ASTEXTAlias for ST_ASWKT
ST_ASEWKT
ST_GEOHASH
Constructor FunctionsST_MAKELINE
ST_MAKEGEOMPOINTGEOMETRY only
ST_GEOMPOINTAlias for ST_MAKEGEOMPOINT
ST_MAKEPOINTGEOGRAPHY only
ST_POINTAlias for ST_MAKEPOINT
ST_MAKEPOLYGON
ST_POLYGONAlias for ST_MAKEPOLYGON
ST_MAKEPOLYGONORIENTEDGEOGRAPHY only
Accessor FunctionsST_DIMENSION
ST_ENDPOINT
ST_POINTN
ST_SRID
ST_STARTPOINT
ST_X
ST_XMAX
ST_XMIN
ST_Y
ST_YMAX
ST_YMIN
Relationship and Measurement FunctionsHAVERSINE
ST_AREA
ST_AZIMUTH
ST_CONTAINS
ST_COVEREDBY
ST_COVERS
ST_DISJOINT
ST_DISTANCE
ST_DWITHINGEOGRAPHY only
ST_HAUSDORFFDISTANCEGEOGRAPHY only
ST_INTERSECTS
ST_LENGTH
ST_NPOINTS
ST_NUMPOINTSAlias for ST_NPOINTS
ST_PERIMETER
ST_WITHIN
Transformation FunctionsST_BUFFERGEOMETRY only
ST_CENTROID
ST_COLLECT (Scalar and Aggregate)GEOGRAPHY only
ST_DIFFERENCEGEOGRAPHY only
ST_ENVELOPEDeprecated for GEOGRAPHY
ST_INTERPOLATEGEOGRAPHY only
ST_INTERSECTIONGEOGRAPHY only
ST_INTERSECTION_AGG (Scalar and Aggregate)GEOGRAPHY only
ST_SETSRIDGEOMETRY only
ST_SIMPLIFY
ST_SYMDIFFERENCEGEOGRAPHY only
ST_TRANSFORMGEOMETRY only
ST_UNIONGEOGRAPHY only
ST_UNION_AGG (Scalar and Aggregate)GEOGRAPHY only
Utility FunctionsST_ISVALID
H3 FunctionsH3_CELL_TO_BOUNDARYGEOGRAPHY only
H3_CELL_TO_CHILDRENGEOGRAPHY only
H3_CELL_TO_CHILDREN_STRINGGEOGRAPHY only
H3_CELL_TO_PARENTGEOGRAPHY only
H3_CELL_TO_POINTGEOGRAPHY only
H3_COMPACT_CELLSGEOGRAPHY only
H3_COMPACT_CELLS_STRINGSGEOGRAPHY only
H3_COVERAGEGEOGRAPHY only
H3_COVERAGE_STRINGSGEOGRAPHY only
H3_GET_RESOLUTIONGEOGRAPHY only
H3_GRID_DISTANCEGEOGRAPHY only
H3_GRID_DISKGEOGRAPHY only
H3_GRID_PATHGEOGRAPHY only
H3_INT_TO_STRINGGEOGRAPHY only
H3_IS_PENTAGONGEOGRAPHY only
H3_IS_VALID_CELLGEOGRAPHY only
H3_LATLNG_TO_CELLGEOGRAPHY only
H3_LATLNG_TO_CELL_STRINGGEOGRAPHY only
H3_POINT_TO_CELLGEOGRAPHY only
H3_POINT_TO_CELL_STRINGGEOGRAPHY only
H3_POLYGON_TO_CELLSGEOGRAPHY only
H3_POLYGON_TO_CELLS_STRINGSGEOGRAPHY only
H3_STRING_TO_INTGEOGRAPHY only
H3_TRY_COVERAGEGEOGRAPHY only
H3_TRY_COVERAGE_STRINGSGEOGRAPHY only
H3_TRY_GRID_DISTANCEGEOGRAPHY only
H3_TRY_GRID_PATHGEOGRAPHY only
H3_TRY_POLYGON_TO_CELLSGEOGRAPHY only
H3_TRY_POLYGON_TO_CELLS_STRINGSGEOGRAPHY only
H3_UNCOMPACT_CELLSGEOGRAPHY only
H3_UNCOMPACT_CELLS_STRINGSGEOGRAPHY only