ST_GEOGFROMGEOJSON()
All functions > GEOSPATIAL > ST_GEOGFROMGEOJSON()
Creates a GEOGRAPHY value from a GeoJSON string. Coordinates are interpreted as lon/lat in WGS84.
Signatures
GeoJSON to geography
Returns: A geography value; the sub kind depends on the GeoJSON content
ST_GEOGFROMGEOJSON(geojson: VARCHAR) → GEOG_MULTIANY sql
| Parameter | Type | Required | Description |
|---|---|---|---|
geojson | VARCHAR | Yes | A GeoJSON geometry string |
Signature notes:
- GeoJSON coordinates are always lon/lat in WGS84 per RFC 7946
- Does not accept GeoJSON Feature or FeatureCollection; extract the geometry field first
- Returns NULL if the input is NULL
- Raises an error if the JSON is malformed or not a valid GeoJSON geometry
- On Trino: transpiled to to_spherical_geography(ST_GeomFromGeoJSON(...))
Examples
FeatureQL
SELECT
f1 := ST_ASTEXT(ST_GEOGFROMGEOJSON('{"type":"Point","coordinates":[-122.4194,37.7749]}')) -- GeoJSON Point to geography (San Francisco)
;Result
| f1 VARCHAR |
|---|
| POINT (-122.4194 37.7749) |
On this page