419 if ( PG_ARGISNULL(0) )
422 geom = PG_GETARG_GSERIALIZED_P(0);
425 if ( PG_NARGS() > 1 && !PG_ARGISNULL(1) )
427 precision = PG_GETARG_INT32(1);
428 if ( precision > DBL_DIG )
430 else if ( precision < 0 )
440 if ( PG_NARGS() > 2 && !PG_ARGISNULL(2) )
442 int option = PG_GETARG_INT32(2);
444 if ( option & 2 || option & 4 )
458 "SRID %i unknown in spatial_ref_sys table",
475 result = cstring2text(geojson);
478 PG_FREE_IF_COPY(geom, 0);
479 PG_RETURN_TEXT_P(result);
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
#define SRID_UNKNOWN
Unknown SRID value.
char * lwgeom_to_geojson(const LWGEOM *geo, char *srs, int precision, int has_bbox)
Takes a GEOMETRY and returns a GeoJson representation.
char * getSRSbySRID(int srid, bool short_crs)
int32_t gserialized_get_srid(const GSERIALIZED *s)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...