[OpenLayers-Users] limit zoom levels

Ramiro Cosentino ramaugust at gmail.com
Fri Apr 27 08:48:41 EDT 2012


2012/4/21 Steve Nelson <snelson at webapper.com>

> Have you tried setting numZoomLevels?
>
> Steve
>

Yes, but it doesn't seem to have any effect for OSM Layer.
Here's my code:

    // create map
    map = new OpenLayers.Map({
        div: "map",
        theme: null,
        projection: sm,
        numZoomLevels: 2,
        controls: [
            new OpenLayers.Control.Attribution(),
            new OpenLayers.Control.TouchNavigation({
                dragPanOptions: {
                    enableKinetic: true
                }
            }),
            geolocate,
            selectControl
        ],
        layers: [
            new OpenLayers.Layer.OSM("OpenStreetMap",
"/public/tiles/${z}/${x}/${y}.png", {
                transitionEffect: 'resize'
            }),
            vector,
            sprintersLayer
        ],
        center: new OpenLayers.LonLat(0, 0),
        zoom: 1
    });

I have tried setting the resolutions option, but it tries to fetch
different tiles from those I have already cached for the various zoom
levels I need.

Right now I have cached tiles for zoom levels 10, 12 and 14.

What I'm doing is a mobile app with offline maps, so I need to deal with
cached tiles, which works fine as long as I don't set the resolutions
option.

What should be the way to go with this?

Any tips welcome!
Thanks a lot
Rama
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120427/95cf4f28/attachment.html


More information about the Users mailing list