PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ geom_from_gml()

Datum geom_from_gml ( PG_FUNCTION_ARGS  )

Definition at line 98 of file lwgeom_in_gml.c.

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

Referenced by gml_lwpgerror().

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