[OpenLayers-Users] Setting layer maxResolution and numZoomLevels

Worth Lutz wal3 at mindspring.com
Fri Apr 12 07:07:33 PDT 2013


Thanks for the update. I'll study what you've explained as it may help me
understand the problems I've had.

Worth Lutz

-----Original Message-----
From: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] On Behalf Of rickm81
Sent: Friday, April 12, 2013 9:51 AM
To: openlayers-users at lists.osgeo.org
Subject: Re: [OpenLayers-Users] Setting layer maxResolution and
numZoomLevels

After quite a bit of digging online I was able to find a solution to this
common issue in Open Layers and its supported map layers. 

The issue I had was specifically tied to OpenStreetMaps. I found that it was
necessary that I explicitly define all resolutions with the necessary
zoomOffset in the OSM layer constructor. 

Using the the constructor below I was able to create the layer as I liked.

                var osm_wms = new OpenLayers.Layer.OSM("OSM", null, {
isBaseLayer: true, wrapDateLine: true, displayInLayerSwitcher: true,
zoomOffset: 4, resolutions: [9783.939618750003, 4891.969809375002,
2445.984904687501, 1222.99245234375, 611.4962261718752, 305.7481130859376,
152.8740565429688, 76.4370282714844, 38.2185141357422, 19.1092570678711,
9.55462853393555, 4.77731426696777, 2.38865713348389, 1.19432856674194] });

Resolutions can manually be added by starting with 1.19432856674194 and
adding multiples of two.

I then set the desired map zoom and center without issue. Just thought I
would add a quick update, since layer extent/zoom level seems to be a common
source of confusion for those new to OpenLayers.



--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/Setting-layer-maxResolution-and-numZoomL
evels-tp5044883p5046405.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users
-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2013.0.3272 / Virus Database: 3162/6239 - Release Date: 04/11/13



More information about the Users mailing list