Reuse GML pos reader -- something looks not quite right here, but it does work
This commit is contained in:
@@ -147,51 +147,27 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class(
|
||||
"label": function(node, coverageOfferingBrief) {
|
||||
coverageOfferingBrief.label = this.getChildValue(node);
|
||||
},
|
||||
// "lonLatEnvelope": function(node, coverageOfferingBrief) {
|
||||
// debugger
|
||||
// var bbox = OpenLayers.Format.GML.v3.prototype.readers["gml"].pos.apply(this, [node, coverageOfferingBrief]);
|
||||
// bbox.srs = node.getAttribute("srsName");
|
||||
// coverageOfferingBrief.lonLatEnvelope[bbox.srs] = bbox;
|
||||
// },
|
||||
"lonLatEnvelope": function(node, coverageOfferingBrief) {
|
||||
|
||||
// Look for <gml:pos>. Only write the data if everything parsed neatly.
|
||||
// This works well for the data samples I have access to, but may need to be generalized to cover other possible use cases.
|
||||
var nodeList = this.getElementsByTagNameNS(node, "http://www.opengis.net/gml", "pos");
|
||||
|
||||
// We expect two nodes here, to create the corners of a bounding box
|
||||
if(nodeList.length == 2) {
|
||||
var min = {},
|
||||
max = {};
|
||||
var min = {};
|
||||
var max = {};
|
||||
|
||||
var ok = true;
|
||||
OpenLayers.Format.GML.v3.prototype.readers["gml"].pos.apply(this, [nodeList[0], min]);
|
||||
OpenLayers.Format.GML.v3.prototype.readers["gml"].pos.apply(this, [nodeList[1], max]);
|
||||
|
||||
// min
|
||||
var coordString = nodeList[0].firstChild.nodeValue;
|
||||
|
||||
coordString = coordString.replace(this.regExes.trimSpace, "");
|
||||
var coords = coordString.split(this.regExes.splitSpace);
|
||||
|
||||
if(coords.length == 2) {
|
||||
min.lon = coords[0];
|
||||
min.lat = coords[1];
|
||||
} else {
|
||||
ok = false;
|
||||
}
|
||||
|
||||
// max
|
||||
var coordString = nodeList[1].firstChild.nodeValue;
|
||||
|
||||
coordString = coordString.replace(this.regExes.trimSpace, "");
|
||||
var coords = coordString.split(this.regExes.splitSpace);
|
||||
|
||||
if(coords.length == 2) {
|
||||
max.lon = coords[0];
|
||||
max.lat = coords[1];
|
||||
} else {
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if(ok) {
|
||||
coverageOfferingBrief.lonLatEnvelope = {};
|
||||
coverageOfferingBrief.lonLatEnvelope.srsName = node.getAttribute("srsName");
|
||||
coverageOfferingBrief.lonLatEnvelope.min = min;
|
||||
coverageOfferingBrief.lonLatEnvelope.max = max;
|
||||
}
|
||||
coverageOfferingBrief.lonLatEnvelope = {};
|
||||
coverageOfferingBrief.lonLatEnvelope.srsName = node.getAttribute("srsName");
|
||||
coverageOfferingBrief.lonLatEnvelope.min = min.points[0];
|
||||
coverageOfferingBrief.lonLatEnvelope.max = max.points[0];
|
||||
}
|
||||
},
|
||||
}, OpenLayers.Format.WCSCapabilities.v1.prototype.readers["wcs"])
|
||||
|
||||
Reference in New Issue
Block a user