[OpenLayers-Users] limit zoom levels

Ramiro Cosentino ramaugust at gmail.com
Wed Apr 18 15:48:38 EDT 2012


Dear OL community,

I was searching for quite a while and couldn't find a way to limit the zoom
levels for my maps.

What I'm doing it an offline maps mobile app which should load cached tiles.
It works fine as long as I don't specify resolutions for the Map creation
options.

Right now it looks like this:

new OpenLayers.Layer.OSM("OpenStreetMap",
"/public/tiles/${z}/${x}/${y}.png", {
                                            transitionEffect: 'resize',
                                            isBaseLayer:true,
                                            displayInLayerSwitcher:false,
                                            zoomOffset:10,
                                            resolutions:
[76.43702827453613, 38.218514137268066,

 19.1092570678711, 9.55462853393555,

 4.77731426696777,2.38865713348389,

 1.19432856674194]

It seems like adding resolutions, changes the requested tiles and it
doesn't match any of those I have already downloaded ( using
downloadosmtiles.pl ).

Some of the posts and info I've followed to get where I am are these:


http://trac.osgeo.org/openlayers/wiki/SettingZoomLevels

http://osgeo-org.1560.n6.nabble.com/Can-t-restrict-Openlayers-Layer-OSM-to-use-specific-zoom-levels-td3926546.html

http://forum.openstreetmap.org/viewtopic.php?id=6444

My question is: how should I restrict the zoom levels ( I need, say 11, 12,
13 and 14) ?

Am I doing it the right way and is it just that I have to download the
tiles in some other way?

Thanks in advance for your help!
Rama.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120418/5f04f15a/attachment.html


More information about the Users mailing list