Fix up parsing of OGR GML with ol.format.GML
This commit is contained in:
@@ -73,13 +73,19 @@ ol.format.GMLBase = function(opt_options) {
|
||||
goog.inherits(ol.format.GMLBase, ol.format.XMLFeature);
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
ol.format.GMLBase.GMLNS = 'http://www.opengis.net/gml';
|
||||
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
* @return {Array.<ol.Feature>} Features.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GMLBase.prototype.readFeatures_ = function(node, objectStack) {
|
||||
ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
|
||||
var localName = ol.xml.getLocalName(node);
|
||||
var features;
|
||||
@@ -117,10 +123,10 @@ ol.format.GMLBase.prototype.readFeatures_ = function(node, objectStack) {
|
||||
*/
|
||||
ol.format.GMLBase.prototype.FEATURE_COLLECTION_PARSERS = Object({
|
||||
'http://www.opengis.net/gml': {
|
||||
'featureMember': ol.xml.makeArrayPusher(
|
||||
ol.format.GMLBase.prototype.readFeatures_),
|
||||
'featureMember': ol.xml.makeReplacer(
|
||||
ol.format.GMLBase.prototype.readFeaturesInternal),
|
||||
'featureMembers': ol.xml.makeReplacer(
|
||||
ol.format.GMLBase.prototype.readFeatures_)
|
||||
ol.format.GMLBase.prototype.readFeaturesInternal)
|
||||
}
|
||||
});
|
||||
|
||||
@@ -153,7 +159,7 @@ ol.format.GMLBase.prototype.readGeometryElement = function(node, objectStack) {
|
||||
ol.format.GMLBase.prototype.readFeatureElement = function(node, objectStack) {
|
||||
var n;
|
||||
var fid = node.getAttribute('fid') ||
|
||||
ol.xml.getAttributeNS(node, 'http://www.opengis.net/gml', 'id');
|
||||
ol.xml.getAttributeNS(node, ol.format.GMLBase.GMLNS, 'id');
|
||||
var values = {}, geometryName;
|
||||
for (n = node.firstElementChild; !goog.isNull(n);
|
||||
n = n.nextElementSibling) {
|
||||
@@ -549,7 +555,7 @@ ol.format.GMLBase.prototype.readFeaturesFromNode =
|
||||
if (goog.isDef(opt_options)) {
|
||||
goog.object.extend(options, this.getReadOptions(node, opt_options));
|
||||
}
|
||||
return this.readFeatures_(node, [options]);
|
||||
return this.readFeaturesInternal(node, [options]);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user