ST_GEOMFROMGEOJSON()
All functions > GEOSPATIAL > ST_GEOMFROMGEOJSON()
Creates a GEOMETRY value from a GeoJSON string.
Signatures
GeoJSON to geometry
Returns: A geometry value; the sub kind depends on the GeoJSON content
ST_GEOMFROMGEOJSON(geojson: VARCHAR) → GEOM_MULTIANY sql
| Parameter | Type | Required | Description |
|---|---|---|---|
geojson | VARCHAR | Yes | A GeoJSON geometry string |
Signature notes:
- Accepts any GeoJSON geometry type: Point, LineString, Polygon, Multi*, GeometryCollection
- 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 BigQuery: transpiled to ST_GEOGFROMGEOJSON (returns GEOGRAPHY, not GEOMETRY)
Examples
FeatureQL
SELECT
f1 := ST_ASTEXT(ST_GEOMFROMGEOJSON('{"type":"Point","coordinates":[1.0,2.0]}')) -- GeoJSON Point to geometry
;Result
| f1 VARCHAR |
|---|
| POINT (1 2) |
On this page