[OpenLayers-Dev] FixedZoomLevels

Sébastien Roch roch.sebastien at gmail.com
Tue Oct 30 10:19:26 EDT 2007


Hi Dev,
I had a problem with some Google Layers in my map : I had some layers
with min and maxScale above a google layer (the baselayer). At first
it worked well, but after having zoomed 3 times, the layers don't
appear anymore (the google one is ok)
If at this moment I eval in the console "map.getScale()", it returns "NaN"
I found that the resolutions array of the google layer was not
properly set : this is done in FixedZoomLevels.js, in the
"initResolutions" function :

if (this.RESOLUTIONS != null) {
            var resolutionsIndex = 0;
            this.resolutions = [];
            for(var i= this.minZoomLevel; i < this.numZoomLevels; i++) {
                this.resolutions[resolutionsIndex++] = this.RESOLUTIONS[i];
            }
}

I changed this part with :

if (this.RESOLUTIONS != null) {
            var resolutionsIndex = 0;
            this.resolutions = [];
            for(var i= this.minZoomLevel; i <= this.maxZoomLevel; i++)
{           // HERE
                this.resolutions[resolutionsIndex++] = this.RESOLUTIONS[i];
            }
}

And this works for me. Can anyone tell me if this is right ?
if not, I'll post my code with my layers, maybe I'm wrong with something.
Thanks

Sebastien



More information about the Dev mailing list