PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ parse_gml_point()

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

Parse GML point (2.1.2, 3.1.1)

Definition at line 924 of file lwgeom_in_gml.c.

References get_xlink_node(), gml_lwpgerror(), gml_reproject_pa(), is_xlink(), lwpoint_as_lwgeom(), lwpoint_construct(), lwpoint_construct_empty(), POINTARRAY::npoints, parse_gml_data(), parse_gml_srs(), ptarray_flip_coordinates(), struct_gmlSrs::reverse_axis, struct_gmlSrs::srid, and SRID_UNKNOWN.

Referenced by parse_gml().

925 {
926  gmlSrs srs;
927  LWGEOM *geom;
928  POINTARRAY *pa;
929 
930  if (is_xlink(xnode)) xnode = get_xlink_node(xnode);
931 
932  if (xnode->children == NULL)
933  return lwpoint_as_lwgeom(lwpoint_construct_empty(*root_srid, 0, 0));
934 
935  pa = parse_gml_data(xnode->children, hasz, root_srid);
936  if (pa->npoints != 1) gml_lwpgerror("invalid GML representation", 34);
937 
938  parse_gml_srs(xnode, &srs);
939  if (srs.reverse_axis) pa = ptarray_flip_coordinates(pa);
940  if (!*root_srid)
941  {
942  *root_srid = srs.srid;
943  geom = (LWGEOM *) lwpoint_construct(*root_srid, NULL, pa);
944  }
945  else
946  {
947  if (srs.srid != *root_srid)
948  gml_reproject_pa(pa, srs.srid, *root_srid);
949  geom = (LWGEOM *) lwpoint_construct(SRID_UNKNOWN, NULL, pa);
950  }
951 
952  return geom;
953 }
int npoints
Definition: liblwgeom.h:371
static void gml_lwpgerror(char *msg, int error_code)
Definition: lwgeom_in_gml.c:81
static void parse_gml_srs(xmlNodePtr xnode, gmlSrs *srs)
Parse gml srsName attribute.
LWPOINT * lwpoint_construct_empty(int srid, char hasz, char hasm)
Definition: lwpoint.c:151
static POINTARRAY * gml_reproject_pa(POINTARRAY *pa, int srid_in, int srid_out)
Use Proj4 to reproject a given POINTARRAY.
POINTARRAY * ptarray_flip_coordinates(POINTARRAY *pa)
Reverse X and Y axis on a given POINTARRAY.
Definition: ptarray.c:369
static xmlNodePtr get_xlink_node(xmlNodePtr xnode)
Return a xmlNodePtr on a node referenced by a XLink or NULL otherwise.
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:188
static bool is_xlink(xmlNodePtr node)
Return true if current node contains a simple XLink Return false otherwise.
static POINTARRAY * parse_gml_data(xmlNodePtr xnode, bool *hasz, int *root_srid)
Parse data coordinates.
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
Definition: lwgeom.c:303
LWPOINT * lwpoint_construct(int srid, GBOX *bbox, POINTARRAY *point)
Definition: lwpoint.c:129
Here is the call graph for this function:
Here is the caller graph for this function: