diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js index efc02fe088..017a6fec41 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js @@ -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 . 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"]) diff --git a/tests/Format/WCSCapabilities/v1.html b/tests/Format/WCSCapabilities/v1.html index c38dd7256b..4a713cd491 100644 --- a/tests/Format/WCSCapabilities/v1.html +++ b/tests/Format/WCSCapabilities/v1.html @@ -51,12 +51,13 @@ t.eq(responsibleParty.contactInfo.phone.voice, "6463320", "Service>responsibleParty>ContactInfo>Phone>Voice correctly parsed"); var metadata = res.contentMetadata[0]; + t.eq(metadata.name, "ro_dsm", "ContentMetadata>Name correctly parsed"); t.eq(metadata.label, "Rotterdam DSM", "ContentMetadata>Label correctly parsed"); - t.eq(metadata.lonLatEnvelope.min.lat, "51.515151", "ContentMetadata>lonLatEnvelope>Min>Lat correctly parsed"); - t.eq(metadata.lonLatEnvelope.min.lon, "4.44444", "ContentMetadata>lonLatEnvelope>Min>Lon correctly parsed"); - t.eq(metadata.lonLatEnvelope.max.lat, "52.525252", "ContentMetadata>lonLatEnvelope>Max>Lat correctly parsed"); - t.eq(metadata.lonLatEnvelope.max.lon, "5.55555", "ContentMetadata>lonLatEnvelope>Max>Lon correctly parsed"); + t.eq(metadata.lonLatEnvelope.min.x, 51.515151, "ContentMetadata>lonLatEnvelope>Min>Lat correctly parsed"); + t.eq(metadata.lonLatEnvelope.min.y, 4.44444, "ContentMetadata>lonLatEnvelope>Min>Lon correctly parsed"); + t.eq(metadata.lonLatEnvelope.max.x, 52.525252, "ContentMetadata>lonLatEnvelope>Max>Lat correctly parsed"); + t.eq(metadata.lonLatEnvelope.max.y, 5.55555, "ContentMetadata>lonLatEnvelope>Max>Lon correctly parsed"); t.eq(metadata.lonLatEnvelope.srsName, "urn:ogc:def:crs:OGC:1.3:CRS84", "ContentMetadata>lonLatEnvelope>SrsName correctly parsed"); t.eq(res.contentMetadata.length, 4, "Correct number of metadata records found");