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

Definition at line 84 of file lwgeom_in_gml.c.

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

85 {
87  text *xml_input;
88  LWGEOM *lwgeom;
89  char *xml;
90  int root_srid=SRID_UNKNOWN;
91 
92 
93  /* Get the GML stream */
94  if (PG_ARGISNULL(0)) PG_RETURN_NULL();
95  xml_input = PG_GETARG_TEXT_P(0);
96  xml = text2cstring(xml_input);
97 
98  /* Zero for undefined */
99  root_srid = PG_GETARG_INT32(1);
100 
101  lwgeom = lwgeom_from_gml(xml);
102  if ( root_srid != SRID_UNKNOWN )
103  lwgeom->srid = root_srid;
104 
105  geom = geometry_serialize(lwgeom);
106  lwgeom_free(lwgeom);
107 
108  PG_RETURN_POINTER(geom);
109 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1006
int32_t srid
Definition: liblwgeom.h:355
LWGEOM * geom
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:154
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: