Fix srsDimension read on GML3 for Geoserver
Contrary to Mapserver, Geoserver sets the srsDimension attribute on the child of the geometry node, not on the points list. This fix searches that node as well. A small unit test was also added.
This commit is contained in:
@@ -345,7 +345,7 @@ ol.format.GML3.prototype.readFlatPosList_ = function(node, objectStack) {
|
||||
var s = ol.xml.getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
|
||||
var context = objectStack[0];
|
||||
var containerSrs = context['srsName'];
|
||||
var containerDimension = node.parentNode.getAttribute('srsDimension');
|
||||
var contextDimension = context['srsDimension'];
|
||||
var axisOrientation = 'enu';
|
||||
if (containerSrs) {
|
||||
var proj = ol.proj.get(containerSrs);
|
||||
@@ -360,8 +360,11 @@ ol.format.GML3.prototype.readFlatPosList_ = function(node, objectStack) {
|
||||
} else if (node.getAttribute('dimension')) {
|
||||
dim = ol.format.XSD.readNonNegativeIntegerString(
|
||||
node.getAttribute('dimension'));
|
||||
} else if (containerDimension) {
|
||||
dim = ol.format.XSD.readNonNegativeIntegerString(containerDimension);
|
||||
} else if (node.parentNode.getAttribute('srsDimension')) {
|
||||
dim = ol.format.XSD.readNonNegativeIntegerString(
|
||||
node.parentNode.getAttribute('srsDimension'));
|
||||
} else if (contextDimension) {
|
||||
dim = ol.format.XSD.readNonNegativeIntegerString(contextDimension);
|
||||
}
|
||||
var x, y, z;
|
||||
var flatCoordinates = [];
|
||||
|
||||
@@ -198,6 +198,7 @@ ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
|
||||
ol.format.GMLBase.prototype.readGeometryElement = function(node, objectStack) {
|
||||
var context = /** @type {Object} */ (objectStack[0]);
|
||||
context['srsName'] = node.firstElementChild.getAttribute('srsName');
|
||||
context['srsDimension'] = node.firstElementChild.getAttribute('srsDimension');
|
||||
/** @type {ol.geom.Geometry} */
|
||||
var geometry = ol.xml.pushParseAndPop(null,
|
||||
this.GEOMETRY_PARSERS_, node, objectStack, this);
|
||||
|
||||
Reference in New Issue
Block a user