[OpenLayers-Dev] Google Zoom Levels

Ludwig Max Brinckmann ludwigbrinckmann at gmail.com
Fri Nov 17 07:32:48 EST 2006


I was planning to look a bit more into it this afternoon (London
time), but since people seem to get a bit impatient about it, this is
the preliminary result:

First, we have to up the zoom levels on in Google.js and add some more
resolutions:

    /** @final @type int */
    MAX_ZOOM_LEVEL: 23,

    /** Hardcode these resolutions so that they are more closely
     *   tied with the standard wms projection
     *
     * @final @type Array(float) */
    RESOLUTIONS: [1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.043945312\
5,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.0013732910156\
25,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.00008583068847\
65625,0.00004291534423828125,0.0000214576721191140625,0.000107288360595703125,0\
.0000053644182978515625,0.000002682209014892578125,0.0000013411045074462890625,\
0.00000067055225372314453125],


Then the map needs to be told that to go to a higher maxResolution AND
that there are more zoomLevels, just one of them won't do (why? - I
was planning to look a bit more into the code in FixedZoomLevels.js to
find out).
var map = new OpenLayers.Map('map', {controls:[], numZoomLevels: 19,
maxZoomLevel: 19});

In my case, however, I have decided that I actually want to stop
people zooming out too much so I upped the lower zoom level

var map = new OpenLayers.Map('map', {controls:[], numZoomLevels: 15,
minZoomLevel: 5, maxZoomLevel: 19});

So far, so good, if not very obvious.

But:
Now I have the interesting situation that my layerswitcher stops
working above a certain zoomlevel: the selection boxes just go grey
and I cannot change the selection anymore (and it seems it does not
make anything visible beyond the google base layer.)

E.g.
http://www.yunnanexplorer.com/yunnanmap.html?lat=24.95739&lon=101.91948&zoom=10&layers=BFFFT
shows the grey boxes, while
http://www.yunnanexplorer.com/yunnanmap.html?lat=24.95739&lon=101.91948&zoom=8&layers=BFFFT
enables the layer switcher combo boxes.

Firefox seems to eat any errors while IE throws up an error, in
WMS.Untiled destroy, where this.tile is not defined (this error might
be something completely different, it is IE after all).

I will look a bit more into it later today, but if anyone has an idea.

Ludwig


Is this a feature? Is there a zoomlevel equivalent in the WMS Layers?

Ludwig









On 11/16/06, Schuyler Erle <sderle at metacarta.com> wrote:
> * On 16-Nov-2006 at 11:04AM EST, Ludwig Max Brinckmann said:
> >
> > I noticed there is a resolution array in Google.js -- maybe this is out of
> > date. If so, has someone new data for this and how was it calculated in the
> > first place?
>
> It might well be out of date. I think GMaps goes up to zoom level 24
> or so now in some places -- but only for aerial imagery? You might try
> extending the Layer.Google resolution array locally and see what it
> does. You might also need to change maxZoomLevel in your
> OpenLayers.Map options.
>
> In any event, Google Maps resolutions are precisely a factor of two
> apart. So if you want to extend the resolution array, halve each
> resolution sucessively.
>
> SDE
>
>



More information about the Dev mailing list