ST_GEOGFROMTEXT()

All functions > GEOSPATIAL > ST_GEOGFROMTEXT()

Creates a GEOGRAPHY value from a WKT (Well Known Text) string. Coordinates are interpreted as lon/lat in WGS84.

Signatures

WKT to geography

Returns: A geography value; the sub kind depends on the WKT content

ST_GEOGFROMTEXT(wkt: VARCHAR) → GEOG_MULTIANY
sql
ParameterTypeRequiredDescription
wktVARCHARYesWell Known Text representation of a geography

Signature notes:

  • Coordinates in the WKT are interpreted as longitude, latitude in WGS84
  • Measurement functions on the result return values in meters
  • Returns NULL if the WKT string is NULL
  • Raises an error if the WKT is malformed

Examples

FeatureQL
SELECT
    -- Point in San Francisco (via ST_ASTEXT)
    f1 := ST_ASTEXT(ST_GEOGFROMTEXT('POINT (-122.4194 37.7749)')),
    -- Polygon around central Paris (via ST_ASTEXT)
    f2 := ST_ASTEXT(
        ST_GEOGFROMTEXT(
            'POLYGON ((2.29 48.85, 2.36 48.85, 2.36 48.87, 2.29 48.87, 2.29 48.85))'
        )
    )
;
Result
f1 VARCHARf2 VARCHAR
POINT (-122.4194 37.7749)POLYGON ((2.29 48.85, 2.36 48.85, 2.36 48.87, 2.29 48.87, 2.29 48.85))

Last update at: 2026/06/20 10:08:10