[OpenLayers-Users] Layer.OSM / Layer.XYZ: show only a subset of all available resolutions

Andreas Hocevar ahocevar at opengeo.org
Tue Jan 24 09:20:12 EST 2012


Not with the 2.11 release, but with current master (this was fixed
shortly after the release):

    new OpenLayers.Map({
        div: "map",
        layers: [new OpenLayers.Layer.OSM(null, null, {
            resolutions: [76.43702827148438, 19.109257067871095],
            serverResolutions: [156543.03390625, 78271.516953125,
                39135.7584765625, 19567.87923828125, 9783.939619140625,
                4891.9698095703125, 2445.9849047851562, 1222.9924523925781,
                611.4962261962891, 305.74811309814453, 152.87405654907226,
                76.43702827453613, 38.218514137268066, 19.109257068634033,
                9.554628534317017, 4.777314267158508, 2.388657133579254,
                1.194328566789627, 0.5971642833948135, 0.29858214169740677,
                0.14929107084870338, 0.07464553542435169]
        })],
        center: new OpenLayers.LonLat(16.37, 48.21).transform(
            new OpenLayers.Projection("EPSG:4326"),
            new OpenLayers.Projection("EPSG:900913")
        )
    });

Andreas.

On Tue, Jan 24, 2012 at 2:31 PM, Marc Jansen <jansen at terrestris.de> wrote:
> Hi list,
>
> I currently fail at implementing the following:
>
> Build a map that has a OpenLayers.Layer.OSM-layer, but which will only
> display some of the possible zoomlevels, e.g. only the zoomlevel 11
> (resolution = 76.43702827148438) and the zoomlevel 13 (resolution =
> 19.109257067871095).
>
> This sounds easy at first... but yet I am struggling with this. I tried
> numerous combinations of resolutions, serverResolutions and zoomOffset but
> without success. Is this doable with current 2.11-API?
>
> Thanks for any help on this.
>
> Best regards,
> Marc
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list