Geospatial Functions¶

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

Sub-category

Function

Notes

Conversion / Input / Parsing

ST_GEOGFROMGEOHASH

GEOGRAPHY only

ST_GEOGPOINTFROMGEOHASH

GEOGRAPHY only

ST_GEOGRAPHYFROMWKB

GEOGRAPHY only

ST_GEOGRAPHYFROMWKT

GEOGRAPHY only

ST_GEOMETRYFROMWKB

GEOMETRY only

ST_GEOMETRYFROMWKT

GEOMETRY only

ST_GEOMFROMGEOHASH

GEOMETRY only

ST_GEOMPOINTFROMGEOHASH

GEOMETRY only

TO_GEOGRAPHY

GEOGRAPHY only

TO_GEOMETRY

GEOMETRY only

TRY_TO_GEOGRAPHY

GEOGRAPHY only

TRY_TO_GEOMETRY

GEOMETRY only

Conversion / Output / Formatting

ST_ASGEOJSON

ST_ASWKB

ST_ASBINARY

Alias for ST_ASWKB

ST_ASEWKB

ST_ASWKT

ST_ASTEXT

Alias for ST_ASWKT

ST_ASEWKT

ST_GEOHASH

Constructor Functions

ST_MAKELINE

ST_MAKEGEOMPOINT

GEOMETRY only

ST_GEOMPOINT

Alias for ST_MAKEGEOMPOINT

ST_MAKEPOINT

GEOGRAPHY only

ST_POINT

Alias for ST_MAKEPOINT

ST_MAKEPOLYGON

ST_POLYGON

Alias for ST_MAKEPOLYGON

ST_MAKEPOLYGONORIENTED

GEOGRAPHY only

Accessor Functions

ST_DIMENSION

ST_ENDPOINT

ST_POINTN

ST_SRID

ST_STARTPOINT

ST_X

ST_XMAX

ST_XMIN

ST_Y

ST_YMAX

ST_YMIN

Relationship and Measurement Functions

HAVERSINE

ST_AREA

ST_AZIMUTH

ST_CONTAINS

ST_COVEREDBY

ST_COVERS

ST_DISJOINT

ST_DISTANCE

ST_DWITHIN

GEOGRAPHY only

ST_HAUSDORFFDISTANCE

GEOGRAPHY only

ST_INTERSECTS

ST_LENGTH

ST_NPOINTS

ST_NUMPOINTS

Alias for ST_NPOINTS

ST_PERIMETER

ST_WITHIN

Transformation Functions

ST_BUFFER

GEOMETRY only

ST_CENTROID

ST_COLLECT (Scalar and Aggregate)

GEOGRAPHY only

ST_DIFFERENCE

GEOGRAPHY only

ST_ENVELOPE

Deprecated for GEOGRAPHY

ST_INTERSECTION

GEOGRAPHY only

ST_INTERSECTION_AGG (Scalar and Aggregate)

GEOGRAPHY only

ST_SETSRID

GEOMETRY only

ST_SIMPLIFY

ST_SYMDIFFERENCE

GEOGRAPHY only

ST_TRANSFORM

GEOMETRY only

ST_UNION

GEOGRAPHY only

ST_UNION_AGG (Scalar and Aggregate)

GEOGRAPHY only

Utility Functions

ST_ISVALID

H3 Functions

H3_CELL_TO_BOUNDARY

GEOGRAPHY only

H3_CELL_TO_CHILDREN

GEOGRAPHY only

H3_CELL_TO_CHILDREN_STRING

GEOGRAPHY only

H3_CELL_TO_PARENT

GEOGRAPHY only

H3_CELL_TO_POINT

GEOGRAPHY only

H3_COVERAGE

GEOGRAPHY only

H3_COVERAGE_STRINGS

GEOGRAPHY only

H3_GET_RESOLUTION

GEOGRAPHY only

H3_GRID_DISTANCE

GEOGRAPHY only

H3_GRID_DISK

GEOGRAPHY only

H3_GRID_PATH

GEOGRAPHY only

H3_INT_TO_STRING

GEOGRAPHY only

H3_LATLNG_TO_CELL

GEOGRAPHY only

H3_LATLNG_TO_CELL_STRING

GEOGRAPHY only

H3_POINT_TO_CELL

GEOGRAPHY only

H3_POINT_TO_CELL_STRING

GEOGRAPHY only

H3_POLYGON_TO_CELLS

GEOGRAPHY only

H3_POLYGON_TO_CELLS_STRINGS

GEOGRAPHY only

H3_STRING_TO_INT

GEOGRAPHY only