PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ parse_gml()

static LWGEOM * parse_gml ( xmlNodePtr  xnode,
bool *  hasz,
int *  root_srid 
)
static

Parse GML.

Definition at line 1983 of file lwgeom_in_gml.c.

1984 {
1985  xmlNodePtr xa = xnode;
1986  gmlSrs srs;
1987 
1988  /* Scroll forward to the root node */
1989  while (xa != NULL &&
1990  (xa->type != XML_ELEMENT_NODE || !is_gml_namespace(xa, false)))
1991  {
1992  xa = xa->next;
1993  }
1994 
1995  if (xa == NULL) gml_lwpgerror("invalid GML representation", 55);
1996 
1997  parse_gml_srs(xa, &srs);
1998  if (*root_srid == SRID_UNKNOWN && srs.srid != SRID_UNKNOWN)
1999  {
2000  *root_srid = srs.srid;
2001  }
2002 
2003  if (is_gml_element(xa, "Point"))
2004  return parse_gml_point(xa, hasz, root_srid);
2005 
2006  if (is_gml_element(xa, "LineString"))
2007  return parse_gml_line(xa, hasz, root_srid);
2008 
2009  if (is_gml_element(xa, "Curve"))
2010  return parse_gml_curve(xa, hasz, root_srid);
2011 
2012  if (is_gml_element(xa, "LinearRing"))
2013  return parse_gml_linearring(xa, hasz, root_srid);
2014 
2015  if (is_gml_element(xa, "Polygon"))
2016  return parse_gml_polygon(xa, hasz, root_srid);
2017 
2018  if (is_gml_element(xa, "Triangle"))
2019  return parse_gml_triangle(xa, hasz, root_srid);
2020 
2021  if (is_gml_element(xa, "Surface"))
2022  return parse_gml_surface(xa, hasz, root_srid);
2023 
2024  if (is_gml_element(xa, "MultiPoint"))
2025  return parse_gml_mpoint(xa, hasz, root_srid);
2026 
2027  if (is_gml_element(xa, "MultiLineString"))
2028  return parse_gml_mline(xa, hasz, root_srid);
2029 
2030  if (is_gml_element(xa, "MultiCurve"))
2031  return parse_gml_mcurve(xa, hasz, root_srid);
2032 
2033  if (is_gml_element(xa, "MultiPolygon"))
2034  return parse_gml_mpoly(xa, hasz, root_srid);
2035 
2036  if (is_gml_element(xa, "MultiSurface"))
2037  return parse_gml_msurface(xa, hasz, root_srid);
2038 
2039  if (is_gml_element(xa, "PolyhedralSurface"))
2040  return parse_gml_psurface(xa, hasz, root_srid);
2041 
2042  if (is_gml_element(xa, "Tin") ||
2043  is_gml_element(xa, "TriangulatedSurface"))
2044  return parse_gml_tin(xa, hasz, root_srid);
2045 
2046  if (is_gml_element(xa, "MultiGeometry"))
2047  return parse_gml_coll(xa, hasz, root_srid);
2048 
2049  gml_lwpgerror("invalid GML representation", 56);
2050  return NULL; /* Never reach */
2051 }
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:215
static LWGEOM * parse_gml_surface(xmlNodePtr xnode, bool *hasz, int *root_srid)
Parse GML Surface (3.1.1)
static LWGEOM * parse_gml_msurface(xmlNodePtr xnode, bool *hasz, int *root_srid)
Parse GML MultiSurface (3.1.1)
static LWGEOM * parse_gml_psurface(xmlNodePtr xnode, bool *hasz, int *root_srid)
Parse GML PolyhedralSurface (3.1.1) Nota: It's not part of SF-2.
static LWGEOM * parse_gml_coll(xmlNodePtr xnode, bool *hasz, int *root_srid)
Parse GML MultiGeometry (2.1.2, 3.1.1)
static LWGEOM * parse_gml_mcurve(xmlNodePtr xnode, bool *hasz, int *root_srid)
Parse GML MultiCurve (3.1.1)
static bool is_gml_namespace(xmlNodePtr xnode, bool is_strict)
Return false if current element namespace is not a GML one Return true otherwise.
static void parse_gml_srs(xmlNodePtr xnode, gmlSrs *srs)
Parse gml srsName attribute.
static LWGEOM * parse_gml_polygon(xmlNodePtr xnode, bool *hasz, int *root_srid)
Parse GML Polygon (2.1.2, 3.1.1)
static LWGEOM * parse_gml_line(xmlNodePtr xnode, bool *hasz, int *root_srid)
Parse GML lineString (2.1.2, 3.1.1)
static LWGEOM * parse_gml_mpoly(xmlNodePtr xnode, bool *hasz, int *root_srid)
Parse GML MultiPolygon (2.1.2, 3.1.1)
static LWGEOM * parse_gml_curve(xmlNodePtr xnode, bool *hasz, int *root_srid)
Parse GML Curve (3.1.1)
static void gml_lwpgerror(char *msg, __attribute__((__unused__)) int error_code)
Definition: lwgeom_in_gml.c:81
static LWGEOM * parse_gml_mpoint(xmlNodePtr xnode, bool *hasz, int *root_srid)
Parse gml:MultiPoint (2.1.2, 3.1.1)
static LWGEOM * parse_gml_point(xmlNodePtr xnode, bool *hasz, int *root_srid)
Parse GML point (2.1.2, 3.1.1)
static LWGEOM * parse_gml_tin(xmlNodePtr xnode, bool *hasz, int *root_srid)
Parse GML Tin (and TriangulatedSurface) (3.1.1)
static LWGEOM * parse_gml_triangle(xmlNodePtr xnode, bool *hasz, int *root_srid)
Parse GML Triangle (3.1.1)
static LWGEOM * parse_gml_mline(xmlNodePtr xnode, bool *hasz, int *root_srid)
Parse gml:MultiLineString (2.1.2, 3.1.1)
static bool is_gml_element(xmlNodePtr xn, const char *gml_name)
static LWGEOM * parse_gml_linearring(xmlNodePtr xnode, bool *hasz, int *root_srid)
Parse GML LinearRing (3.1.1)

References gml_lwpgerror(), is_gml_element(), is_gml_namespace(), parse_gml_coll(), parse_gml_curve(), parse_gml_line(), parse_gml_linearring(), parse_gml_mcurve(), parse_gml_mline(), parse_gml_mpoint(), parse_gml_mpoly(), parse_gml_msurface(), parse_gml_point(), parse_gml_polygon(), parse_gml_psurface(), parse_gml_srs(), parse_gml_surface(), parse_gml_tin(), parse_gml_triangle(), struct_gmlSrs::srid, and SRID_UNKNOWN.

Referenced by lwgeom_from_gml(), parse_gml_coll(), parse_gml_mcurve(), parse_gml_mline(), parse_gml_mpoint(), parse_gml_mpoly(), and parse_gml_msurface().

Here is the call graph for this function:
Here is the caller graph for this function: