All Products
Search
Document Center

ApsaraDB RDS:ST_GeomFromGeoJSON

Last Updated:Mar 28, 2026

Constructs a geometry object from a GeoJSON string.

Syntax

geometry ST_GeomFromGeoJSON(text geomjson);
geometry ST_GeomFromGeoJSON(json geomjson);
geometry ST_GeomFromGeoJSON(jsonb geomjson);

Parameters

ParameterDescription
geomjsonA GeoJSON geometry fragment of type text, json, or jsonb.

Usage notes

  • Pass a GeoJSON geometry fragment, not a complete GeoJSON document. Passing a full document returns an error.

  • 3D geometries are fully supported. The Z coordinate is preserved in the constructed geometry object.

Examples

2D point

SELECT ST_AsText(ST_GeomFromGeoJSON('{"type":"Point","coordinates":[116,40]}'));

Output:

   st_astext
---------------
 POINT(116 40)
(1 row)