384 int output_guess_short_srid =
LW_FALSE;
392 geom = PG_GETARG_GSERIALIZED_P(0);
396 if ( PG_NARGS() > 1 && !PG_ARGISNULL(1) )
412 if (PG_NARGS() > 2 && !PG_ARGISNULL(2))
414 int option = PG_GETARG_INT32(2);
421 output_guess_short_srid =
LW_TRUE;
426 if (srid !=
SRID_UNKNOWN && (output_short_crs || output_long_crs))
432 elog(ERROR,
"SRID %i unknown in spatial_ref_sys table", srid);
443 result = cstring_to_text(geojson);
446 PG_FREE_IF_COPY(geom, 0);
447 PG_RETURN_TEXT_P(result);
int32_t gserialized_get_srid(const GSERIALIZED *g)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
#define LW_TRUE
Return types for functions with status returns.
#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(FunctionCallInfo fcinfo, int32_t srid, bool short_crs)