Skip to main content
GEOMETRY is the native SQL type for planar spatial values. Its coordinate reference system (CRS) is part of the type descriptor. Spatial operations use that CRS’s coordinate units. For example, planar distance in EPSG:3857 uses projected meters. Operations on two planar values may require matching CRS descriptors.

Distance and area

See ST_Distance for distance and ST_Area for area. Distance uses the input CRS coordinate unit and area uses its square. For example, EPSG:3857 uses projected meters for distance and projected square meters for area.

Construct a value

Use ST_GeomFromText for Well-Known Text (WKT) or ST_GeomFromWKB for Well-Known Binary (WKB). Both native constructors require an explicit CRS string literal and accept the seven XY OGC families, including typed EMPTY values. The one-argument ST_GeomFromText(wkt) returns the legacy VARCHAR encoding.

Query and serialize

To return a value to the client, serialize it as WKT with ST_AsText or as WKB with ST_AsBinary. To reproject between supported coordinate systems, use ST_Transform. For compatible Iceberg fields, see Iceberg type mapping. For spherical longitude and latitude, see GEOGRAPHY. Browse the spatial functions by operation.