PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ geometry_to_json()

Datum geometry_to_json ( PG_FUNCTION_ARGS  )

Definition at line 266 of file lwgeom_export.c.

267 {
268  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
269  LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
270  lwvarlena_t *geojson = lwgeom_to_geojson(lwgeom, NULL, 15, 0);
271  lwgeom_free(lwgeom);
272  PG_FREE_IF_COPY(geom, 0);
273  PG_RETURN_TEXT_P(geojson);
274 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:239
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1138
lwvarlena_t * lwgeom_to_geojson(const LWGEOM *geo, const char *srs, int precision, int has_bbox)
Takes a GEOMETRY and returns a GeoJson representation.
Definition: lwout_geojson.c:49

References lwgeom_free(), lwgeom_from_gserialized(), and lwgeom_to_geojson().

Here is the call graph for this function: