PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ geom_from_gml()

Datum geom_from_gml ( PG_FUNCTION_ARGS  )

Definition at line 83 of file lwgeom_in_gml.c.

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

Referenced by gml_lwpgerror().

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