[OpenLayers-Dev] use a layer's maxextent to determine visibility

John Pulles john.pulles at gmail.com
Thu Jun 19 05:30:06 EDT 2008

Hi list,

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.
The calculateInRange function of the Layer class could be extended by
checking that the current map extent intersects with the maxextent of a

    calculateInRange: function() {
        var inRange = false;
        if (this.map) {
            var resolution = this.map.getResolution();
            inRange = ( (resolution >= this.minResolution) &&
                        (resolution <= this.maxResolution) );
            var extent = this.map.getExtent();
            if (extent) {
                // check that maxExtent of layer is within the current
                inRange = inRange &&
        return inRange;

Would this fit in with OpenLayers or are there disadvantages which I don't

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20080619/43526c14/attachment.html

More information about the Dev mailing list