I have a partial GML object with the geometry type
polygon. The GML version must be 3+ since the coordinates are wrapped in the
<gml:Polygon srsName="EPSG:25832" xmlns:gml="http://www.opengis.net/gml"> <gml:exterior> <gml:LinearRing srsName="EPSG:25832"> <gml:posList> N points where N is an even integer. </gml:posList> </gml:LinearRing> </gml:exterior> </gml:Polygon>
I am using OpenLayers 2.10 and I am trying to convert the GML object into an OpenLayers feature using the OpenLayers.Format.GML class.
When executing the
parseFeature method, which later calls the
parseGeometry.linestring I encounter this comment:
/** * Two coordinate variations to consider: * 1) <gml:posList dimension="d">x0 y0 z0 x1 y1 z1</gml:posList> * 2) <gml:coordinates>x0, y0, z0 x1, y1, z1</gml:coordinates> */
And this line of code which assumes the
dimension attribute to be present:
var dim = parseInt(nodeList.getAttribute("dimension"));
In OpenLayers.Format.GML.v3 the same line of code looks like this:
var dim = parseInt(node.getAttribute("dimension")) || 2;
The problematic difference for me is the
|| 2 part which assumes that a missing dimension means 2 dimensional - which is what I want.
Then why not use the v3 edition, but the OpenLayers.Format.GML.v3 does not implement the
I am recieving GML features from various services and I do not control them.
What is the best approach to handle this problem?