Parse data coordinates.
There's several ways to encode data coordinates, who could be mixed inside a single geometrie:
922{
924 xmlNodePtr xa, xb;
926 bool found;
927
928 pa = NULL;
929
930 for (xa = xnode ; xa != NULL ; xa = xa->next)
931 {
932 if (xa->type != XML_ELEMENT_NODE) continue;
934 if (xa->name == NULL) continue;
935
937 {
939 if (pa == NULL) pa = tmp_pa;
941
942 }
944 {
946 if (pa == NULL) pa = tmp_pa;
948
949 }
951 {
953 if (pa == NULL) pa = tmp_pa;
955
956 }
958 {
960 if (pa == NULL) pa = tmp_pa;
962
963 }
966 {
967 found = false;
968 for (xb = xa->children ; xb != NULL ; xb = xb->next)
969 {
970 if (xb->type != XML_ELEMENT_NODE) continue;
973 {
974 found = true;
975 break;
976 }
977 }
978 if (!found || xb == NULL)
980
982 if (xb == NULL || xb->children == NULL)
984
986 if (tmp_pa->npoints != 1)
988
992 else if (srs.
srid != *root_srid)
994 if (pa == NULL) pa = tmp_pa;
996 }
997 }
998
999 if (pa == NULL)
gml_lwpgerror(
"invalid GML representation", 32);
1000
1001 return pa;
1002}
POINTARRAY * ptarray_flip_coordinates(POINTARRAY *pa)
Reverse X and Y axis on a given POINTARRAY.
POINTARRAY * ptarray_merge(POINTARRAY *pa1, POINTARRAY *pa2)
Merge two given POINTARRAY and returns a pointer on the new aggregate one.
#define SRID_UNKNOWN
Unknown SRID value.
static POINTARRAY * parse_gml_coordinates(xmlNodePtr xnode, bool *hasz)
Parse gml:coordinates.
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 * parse_gml_pos(xmlNodePtr xnode, bool *hasz)
Parse gml:pos.
static POINTARRAY * gml_reproject_pa(POINTARRAY *pa, int32_t epsg_in, int32_t epsg_out)
Use Proj to reproject a given POINTARRAY.
static POINTARRAY * parse_gml_poslist(xmlNodePtr xnode, bool *hasz)
Parse gml:posList.
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 POINTARRAY * parse_gml_coord(xmlNodePtr xnode, bool *hasz)
Parse gml:coord.
static void gml_lwpgerror(char *msg, __attribute__((__unused__)) int error_code)
static POINTARRAY * parse_gml_data(xmlNodePtr xnode, bool *hasz, int *root_srid)
Parse data coordinates.
static bool is_gml_element(xmlNodePtr xn, const char *gml_name)