PostGIS  2.3.7dev-r@@SVN_REVISION@@
Datum geom_from_gml ( PG_FUNCTION_ARGS  )

Definition at line 97 of file lwgeom_in_gml.c.

References geometry_serialize(), lwgeom_free(), lwgeom_from_gml(), LWGEOM::srid, SRID_UNKNOWN, and text2cstring().

98 {
99  GSERIALIZED *geom;
100  text *xml_input;
101  LWGEOM *lwgeom;
102  char *xml;
103  int root_srid=SRID_UNKNOWN;
104 
105 
106  /* Get the GML stream */
107  if (PG_ARGISNULL(0)) PG_RETURN_NULL();
108  xml_input = PG_GETARG_TEXT_P(0);
109  xml = text2cstring(xml_input);
110 
111  /* Zero for undefined */
112  root_srid = PG_GETARG_INT32(1);
113 
114  lwgeom = lwgeom_from_gml(xml);
115  if ( root_srid != SRID_UNKNOWN )
116  lwgeom->srid = root_srid;
117 
118  geom = geometry_serialize(lwgeom);
119  lwgeom_free(lwgeom);
120 
121  PG_RETURN_POINTER(geom);
122 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1063
int32_t srid
Definition: liblwgeom.h:398
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:187
char * text2cstring(const text *textptr)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
static LWGEOM * lwgeom_from_gml(const char *wkt)
Read GML.

Here is the call graph for this function: