PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ geom_from_gml()

Datum geom_from_gml ( PG_FUNCTION_ARGS  )

Definition at line 97 of file lwgeom_in_gml.c.

98 {
99  GSERIALIZED *geom;
100  text *xml_input;
101  LWGEOM *lwgeom;
102  char *xml;
103  int root_srid=SRID_UNKNOWN;
104  int xml_size;
105 
106  /* Get the GML stream */
107  if (PG_ARGISNULL(0)) PG_RETURN_NULL();
108  xml_input = PG_GETARG_TEXT_P(0);
109  xml = text_to_cstring(xml_input);
110  xml_size = VARSIZE_ANY_EXHDR(xml_input);
111 
112  /* Zero for undefined */
113  root_srid = PG_GETARG_INT32(1);
114 
115  lwgeom = lwgeom_from_gml(xml, xml_size);
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 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1155
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:215
static LWGEOM * lwgeom_from_gml(const char *wkt, int xml_size)
Read GML.
int32_t srid
Definition: liblwgeom.h:460

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

Here is the call graph for this function: