Hi list,<br><br>I'm working on a site where many wms providers are used, covering only a relatively small area of the country. Since the maxextent of their layers is known, I would like this maxextent to be used when OpenLayers calculates the visibility of the layer, thus preventing many getmap requests for empty layer images. <br>
The calculateInRange function of the Layer class could be extended by checking that the current map extent intersects with the maxextent of a layer.<br><br><span style="font-family: courier new,monospace;"> calculateInRange: function() {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> var inRange = false;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> if (this.map) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> var resolution = this.map.getResolution();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> inRange = ( (resolution >= this.minResolution) &&</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> (resolution <= this.maxResolution) );</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> var extent = this.map.getExtent();</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> if (extent) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> // check that maxExtent of layer is within the current extent</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> inRange = inRange && extent.intersectsBounds(this.maxExtent);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> }</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> return inRange;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> },</span><br><br>Would this fit in with OpenLayers or are there disadvantages which I don't see?<br><br>Regards,<br>John<br>