[OpenLayers-Dev] Re: OpenLayers 2.11 loading layer data regardless of maxResolution

Ruben Schoenefeld rschoenefeld at utah.gov
Tue May 8 21:04:05 EDT 2012

I created two pages, one is using OpenLayers 2.10, the other one is using



When either of those pages loads, they zoom out to show all of Utah. I
turned on some default OpenLayers controls (navigation, etc) but not using
the layer switcher, because instead of allowing multiple overlays, I am
allowing only either the Routes layer or the Streets layer. In the version
for 2.10, I am including a region defining OpenLayers.Layer.ArcGISCache but
in 2.11 I left it out as it seems to be included in there already.

When defining the routes and streets layers, I am using a subset of the
resolutions array. For the routes layer, the allowable resolutions are:
[19.1092578131615, 9.55462890525781, 4.77731445262891, 2.38865722657904,
1.19432861315723, 0.597164306578613, 0.298582153289307]
For the street centerline layer, the resolutions are:
[2.38865722657904, 1.19432861315723, 0.597164306578613, 0.298582153289307]

In 2.10, everything works fine, I can zoom in and out, switch back and forth
between the two layers (using the two items at the top of the page) and once
the selected layer comes into range, the data is displayed as expected.

In 2.11 however, if I am zoomed outside of the range of the resolutions of
either routes or centerline and I switch from the routes layer (visibility:
true when loaded) to the centerline layer, OpenLayers loads first the routes
and then the centerlines data, which, when you are zoomed out far enough to
show the whole state will very likely crash your browser, so zoom in a
little bit first.

In the console (use Firebug etc to display), I am showing the map resolution
and whether or not route and centerline layers are in range (using
layer.calculateInRange()). Once you click the links to change layers, that's
displayed in the console as well.

Some other thing I noticed: In 2.10, when zoomed out all the way, I can
double click on a point to zoom in by two steps, or draw a zoom box while
holding the shift key. In 2.11, when I do that, The map does not go where I
drew the zoom box but slides north (at least while trying it out now). I
suspect I am just doing something wrong when creating the layers, but maybe
somebody has an idea about that too. That's actually not something I noticed
earlier, so it might just happen in this minimal example.

Thanks for your help.

View this message in context: http://osgeo-org.1560.n6.nabble.com/OpenLayers-2-11-loading-layer-data-regardless-of-maxResolution-tp4950549p4961845.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.

More information about the Dev mailing list