388{
390 int has_bbox = 0;
391 const char *srs = NULL;
394 int option = PG_GETARG_INT32(2);
396
399
400
401
402
403
404
405
406
407 if (option & 2 || option & 4)
408 {
409
410 if (option & 2)
412 if (option & 4)
414
415 if (!srs)
416 {
417 elog(ERROR, "SRID SRID_DEFAULT unknown in spatial_ref_sys table");
418 PG_RETURN_NULL();
419 }
420 }
421
422 if (option & 1) has_bbox = 1;
423
426 PG_FREE_IF_COPY(g, 0);
427
428 PG_RETURN_TEXT_P(geojson);
429}
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
lwvarlena_t * lwgeom_to_geojson(const LWGEOM *geo, const char *srs, int precision, int has_bbox)
Takes a GEOMETRY and returns a GeoJson representation.