ST_TOGEOGRAPHY()

All functions > GEOSPATIAL > ST_TOGEOGRAPHY()

Casts a GEOMETRY to GEOGRAPHY, reinterpreting coordinates as lon/lat in WGS84 without reprojection.

Signatures

Geometry to geography

Returns: The same shape as a geography

ST_TOGEOGRAPHY(geo: T) → GEOG_MULTIANY
sql
ParameterTypeRequiredDescription
geoTYesGeometry value (coordinates must already be in WGS84 lon/lat)

With:

  • T : Custom types: GEOM_POINT | GEOM_LINESTRING | GEOM_POLYGON | GEOM_MULTIPOINT | GEOM_MULTILINESTRING | GEOM_MULTIPOLYGON | GEOM_MULTIANY

Signature notes:

  • Does NOT reproject coordinates; it only changes the type tag
  • The input geometry must already have WGS84 lon/lat coordinates (SRID 4326)
  • To convert from a projected CRS, use ST_TRANSFORM first
  • On DuckDB, BigQuery, and DataFusion: a no-op cast at the type level
  • On Trino: transpiled to to_spherical_geography()
  • Returns NULL if the input is NULL

Examples

FeatureQL
SELECT
    f1 := ST_ASTEXT(ST_TOGEOGRAPHY(ST_GEOMPOINT(-122.4194, 37.7749))) -- Reinterpret a WGS84 geometry point as geography
;
Result
f1 VARCHAR
POINT (-122.4194 37.7749)

Last update at: 2026/05/26 17:22:09