83{
84#ifndef HAVE_LIBJSON
85 elog(ERROR, "You need JSON-C for ST_GeomFromGeoJSON");
86 PG_RETURN_NULL();
87#else
88
91 text *geojson_input;
92 char *geojson;
93 char *srs = NULL;
95
96
97 if (PG_ARGISNULL(0))
98 PG_RETURN_NULL();
99
100 geojson_input = PG_GETARG_TEXT_P(0);
102
105 if (!lwgeom)
106 {
107
108 elog(ERROR, "lwgeom_from_geojson returned NULL");
109 PG_RETURN_NULL();
110 }
111
112 if (srs)
113 {
114 srid = GetSRIDCacheBySRS(fcinfo, srs);
116 }
117
119 geom = geometry_serialize(lwgeom);
121
122 PG_RETURN_POINTER(geom);
123#endif
124}
void lwgeom_set_srid(LWGEOM *geom, int32_t srid)
Set the SRID on an LWGEOM For collections, only the parent gets an SRID, all the children get SRID_UN...
void lwgeom_free(LWGEOM *geom)
LWGEOM * lwgeom_from_geojson(const char *geojson, char **srs)
Create an LWGEOM object from a GeoJSON representation.
static char * text2cstring(const text *textptr)