[OpenLayers-Dev] Google Zoom Levels

Ludwig Max Brinckmann ludwigbrinckmann at gmail.com
Sat Nov 18 10:47:46 EST 2006


Eric,

I had another look at this.
As indicated in a previous post, the Google layer works when putting
the additional resolutions in and telling the map that there are more
zoomlevels and that the maxzoomlevel is higher.
At this point everything works as expected, including WMS Layers.

Where the WMS Layers then screw up is when adding a minZoomLevel (to
prevent users zooming further out), such as this:

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

At this point the WMS Layers become disabled at the higher
resolutions. So the entire thing does not have anything to do with the
Google layer, but without having time right now to delve into this
further, there seems to be something going wrong in the calculation of
the minResolution for Layers, when there is a minZoomlevel set. The
function called is calculateInRange() in Layer.js., which looks at the
min/max resolutions.

Hope this helps to narrow this a little down, but I just have no more
time right now.

Something else I noticed:
when asking for a higher zoom level eg. 16 where 15 is the maximum
zoom level through the URL (such as when using a permalink), it goes
to the lowest zoom, i.e. the whole world seven times over. I have not
tried to track this down, but find this behaviour not intuitive: it
should go to the highest zoom level supported.


Ludwig


On 11/17/06, Erik Uzureau <euzuro at gmail.com> wrote:
> ludwig, I will try to take a look at this if I have a spare moment
> this weekend... if not I will check it out on monday. I am the one
> who wrote most of this code, as well as this wiki which is
> supposed to help people figure this out:
>
> http://trac.openlayers.org/wiki/SettingZoomLevels
>
> Let me know if you come to any resolutions, and if not, i'll take
> a look ASAP.
>
> regards,
> Erik
>
> On 11/17/06, Ludwig Max Brinckmann <ludwigbrinckmann at gmail.com> wrote:
> > 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
> > >
> > >
> > _______________________________________________
> > Dev mailing list
> > Dev at openlayers.org
> > http://openlayers.org/mailman/listinfo/dev
> >
>



More information about the Dev mailing list