PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ parse_gml_line()

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

Parse GML lineString (2.1.2, 3.1.1)

Definition at line 1098 of file lwgeom_in_gml.c.

1099 {
1100  gmlSrs srs;
1101  LWGEOM *geom;
1102  POINTARRAY *pa;
1103 
1104  if (is_xlink(xnode)) xnode = get_xlink_node(xnode);
1105  if (xnode == NULL)
1106  gml_lwpgerror("invalid GML representation", 30);
1107 
1108  if (xnode->children == NULL)
1109  return lwline_as_lwgeom(lwline_construct_empty(*root_srid, 0, 0));
1110 
1111  pa = parse_gml_data(xnode->children, hasz, root_srid);
1112  if (pa->npoints < 2) gml_lwpgerror("invalid GML representation", 36);
1113 
1114  parse_gml_srs(xnode, &srs);
1115  if (srs.reverse_axis) pa = ptarray_flip_coordinates(pa);
1116  if (!*root_srid)
1117  {
1118  *root_srid = srs.srid;
1119  geom = (LWGEOM *) lwline_construct(*root_srid, NULL, pa);
1120  }
1121  else
1122  {
1123  if (srs.srid != *root_srid)
1124  gml_reproject_pa(pa, srs.srid, *root_srid);
1125  geom = (LWGEOM *) lwline_construct(SRID_UNKNOWN, NULL, pa);
1126  }
1127 
1128  return geom;
1129 }
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
Definition: lwgeom.c:322
LWLINE * lwline_construct(int32_t srid, GBOX *bbox, POINTARRAY *points)
Definition: lwline.c:42
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:229
POINTARRAY * ptarray_flip_coordinates(POINTARRAY *pa)
Reverse X and Y axis on a given POINTARRAY.
Definition: ptarray.c:368
LWLINE * lwline_construct_empty(int32_t srid, char hasz, char hasm)
Definition: lwline.c:55
static xmlNodePtr get_xlink_node(xmlNodePtr xnode)
Return a xmlNodePtr on a node referenced by a XLink or NULL otherwise.
static bool is_xlink(xmlNodePtr node)
Return true if current node contains a simple XLink Return false otherwise.
static POINTARRAY * gml_reproject_pa(POINTARRAY *pa, int32_t epsg_in, int32_t epsg_out)
Use Proj to reproject a given POINTARRAY.
static void parse_gml_srs(xmlNodePtr xnode, gmlSrs *srs)
Parse gml srsName attribute.
static POINTARRAY * parse_gml_data(xmlNodePtr xnode, bool *hasz, int *root_srid)
Parse data coordinates.
static void gml_lwpgerror(char *msg, __attribute__((__unused__)) int error_code)
Definition: lwgeom_in_gml.c:81
uint32_t npoints
Definition: liblwgeom.h:441

References get_xlink_node(), gml_lwpgerror(), gml_reproject_pa(), is_xlink(), lwline_as_lwgeom(), lwline_construct(), lwline_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().

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