ST_GeomFromGeoJSON — Toma como entrada una representación geojson de una geometría y devuelve un objeto geométrico PostGIS
geometry ST_GeomFromGeoJSON(text geomjson);
geometry ST_GeomFromGeoJSON(json geomjson);
geometry ST_GeomFromGeoJSON(jsonb geomjson);
Construye un objeto geométrico PostGIS desde una representación GeoJSON.
ST_GeomFromGeoJSON solo funciona con fragmentos geométricos JSON. Devolverá un error si intentas utilizar un documento JSON completo.
Enhanced: 3.0.0 parsed geometry defaults to SRID=4326 if not specified otherwise.
Enhanced: 2.5.0 can now accept json and jsonb as inputs.
Disponibilidad: 2.0.0 necesita de - JSON-C >= 0.9
|
|
|
Si no tienes activado el soporte de JSON-C, tendrás un mensaje error en vez de ver la salida. Para activar el soporte JSON-C, ejecuta configure --with-jsondir=/path/to/json-c. Para mas detalles ve a Section 2.2.3, “Configuración”. |
This function supports 3d and will not drop the z-index.
SELECT ST_AsText(ST_GeomFromGeoJSON('{"type":"Point","coordinates":[-48.23456,20.12345]}')) AS wkt;
POINT(-48.23456 20.12345)
This example creates a 3D LineString.
SELECT ST_AsText(ST_GeomFromGeoJSON('{"type":"LineString","coordinates":[[1,2,3],[4,5,6],[7,8,9]]}')) AS wkt;
LINESTRING Z (1 2 3,4 5 6,7 8 9)