489 version = PG_GETARG_INT32(0);
492 elog(ERROR,
"Only GeoJSON 1 is supported");
497 if (PG_ARGISNULL(1) ) PG_RETURN_NULL();
498 g = PG_GETARG_GSERIALIZED_P(1);
504 if (PG_NARGS() >2 && !PG_ARGISNULL(2))
519 if (PG_NARGS() >3 && !PG_ARGISNULL(3))
520 option = PG_GETARG_INT32(3);
522 if (option & 2 || option & 4)
532 elog(ERROR,
"SRID SRID_DEFAULT unknown in spatial_ref_sys table");
537 if (option & 1) has_bbox = 1;
541 PG_FREE_IF_COPY(g, 1);
544 result = cstring_to_text(geojson);
547 PG_RETURN_TEXT_P(result);
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
char * lwgeom_to_geojson(const LWGEOM *geo, char *srs, int precision, int has_bbox)
Takes a GEOMETRY and returns a GeoJson representation.
char * getSRSbySRID(FunctionCallInfo fcinfo, int srid, bool short_crs)