[OpenLayers-Trac] [OpenLayers] #3607: GetCapabilities Extent
ignored when Dimension not defined in the layer
OpenLayers
trac-20090302 at openlayers.org
Tue Jan 17 10:21:43 EST 2012
#3607: GetCapabilities Extent ignored when Dimension not defined in the layer
------------------------------------+---------------------------------------
Reporter: fredmorin | Owner: tschaub
Type: bug | Status: new
Priority: major | Milestone: 2.12 Release
Component: Format.WMSCapabilities | Version: 2.11
Keywords: | State: Needs Discussion
------------------------------------+---------------------------------------
The GetCapabilities (OpenLayers.Format.WMSCapabilities.v1_1) ignores the
extent element when the dimension is defined for a parent layer.
Here is an example of the WMS 1.1.1 IS from the OGC Annex C3:
EXAMPLE:
Here is a <Layer> element with Extents specified in WMS Capabilities
XML ('...'
<Layer>
<!-- Declare dimensions in use. Declarations are inherited by enclosed
Layers. -->
<Dimension name="time" units="ISO8601" />
<Dimension name="temperature" units="Kelvin" unitSymbol="K" />
<Dimension name="elevation" units="EPSG:5030" />
…
<Layer> …
<!-- Specify extent of Layer. Extents are inherited by enclosed Layers.
-->
<Extent name="time"
default="2000-10-17">1996-01-01/2000-10-17/P1D</Extent>
<Extent name="elevation" default="0">0/10000/100</Extent>
<Extent name="temperature" default="300">230,300,400</Extent>
</Layer>
…
</Layer>…
</Layer>
Here is an extract of the OpenLayers.Format.WMSCapabilities.v1_1 sources:
"Extent": function(node, obj) {
var name = node.getAttribute("name").toLowerCase();
if (name in obj["dimensions"]) {
var extent = obj.dimensions[name];
extent.nearestVal =
node.getAttribute("nearestValue") === "1";
extent.multipleVal =
node.getAttribute("multipleValues") === "1";
extent.current = node.getAttribute("current") === "1";
extent["default"] = node.getAttribute("default") ||
"";
var values = this.getChildValue(node);
extent.values = values.split(",");
}
As shown above, if the dimension is not set for the layer, the extent is
ignored. A possible solution to this issue would read as follow:
"Extent": function(node, obj) {
var name = node.getAttribute("name").toLowerCase();
if (name in obj["dimensions"]) {
var extent = obj.dimensions[name];
extent.nearestVal =
node.getAttribute("nearestValue") === "1";
extent.multipleVal =
node.getAttribute("multipleValues") === "1";
extent.current = node.getAttribute("current") === "1";
extent["default"] = node.getAttribute("default") ||
"";
var values = this.getChildValue(node);
extent.values = values.split(",");
}else{
var extent = {name: name};
extent.nearestVal =
node.getAttribute("nearestValue") === "1";
extent.multipleVal =
node.getAttribute("multipleValues") === "1";
extent.current = node.getAttribute("current") === "1";
extent["default"] = node.getAttribute("default") ||
"";
var values = this.getChildValue(node);
extent.values = values.split(",");
if(!obj.extents){
obj.extents = {};
}
obj.extents[extent.name] = extent;
}
--
Ticket URL: <http://trac.openlayers.org/ticket/3607>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer
More information about the Trac
mailing list