103 xmlNodePtr xmlroot=NULL;
106 if (PG_ARGISNULL(0)) PG_RETURN_NULL();
107 xml_input = PG_GETARG_TEXT_P(0);
108 xml = text_to_cstring(xml_input);
109 xml_size = VARSIZE_ANY_EXHDR(xml_input);
113 xmldoc = xmlReadMemory(xml, xml_size, NULL, NULL, 0);
115 if (!xmldoc || (xmlroot = xmlDocGetRootElement(xmldoc)) == NULL)
119 lwpgerror(
"invalid KML representation");
145 geom = geometry_serialize(lwgeom);
151 PG_RETURN_POINTER(geom);
void lwgeom_free(LWGEOM *geom)
LWGEOM * lwgeom_homogenize(const LWGEOM *geom)
void lwgeom_release(LWGEOM *lwgeom)
Free the containing LWGEOM and the associated BOX.
LWGEOM * lwgeom_force_2d(const LWGEOM *geom)
Strip out the Z/M components of an LWGEOM.
static LWGEOM * parse_kml(xmlNodePtr xnode, bool *hasz)
Parse KML.