[OpenLayers-Users] Layer.OSM / Layer.XYZ: show only a subset of
all available resolutions
Andreas Hocevar
ahocevar at opengeo.org
Sat May 12 13:43:52 PDT 2012
Hi,
the right combination of config options is serverResolutions,
maxResolution and numZoomLevels. In your case something like
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
],
maxResolution: 76.43702827453613,
numZoomLevels: 8
Andreas.
On Fri, May 11, 2012 at 12:03 PM, Franz Buchinger <fbuchinger at gmail.com> wrote:
> I'm currently fighting with the same problem... is there already an easier
> way to accomplish this?
>
> I was playing around a while with minZoomLevel/maxZoomLevel but couldn't get
> Openlayers to display just the OSM zoomlevels 11 - 18.
>
> Nevertheless thanks a lot for this valuable hint,
>
> Franz
>
>
> 2012/1/24 Marc Jansen <jansen at terrestris.de>
>>
>> Hi Andreas,
>>
>> helpfull as always! This is indeed a very cool addition to OpenLayers. I
>> will see if the application in question can move to git-master.
>>
>> Thanks a lot and kind regards,
>> Marc
>>
>>
>>
>> On 24.01.2012 15:20, Andreas Hocevar wrote:
>>>
>>> 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
>>>
>>>
>>>
>>
>> _______________________________________________
>> 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