Attached patch fixes a problem I was seeing where layers were being
disabled on the highest (most zoomed-in) zoom level when inheriting
their resolutions from the map.
For map options:
{ maxExtent: new
OpenLayers.Bounds(-20000000,-20000000,20000000,20000000),
maxResolution: 10000, minResolution: 0.15, numZoomLevels: 16, units:
"m", projection: new OpenLayers.Projection("EPSG:900913"), tileSize:
new OpenLayers.Size(384, 384), controls: ([]) }
I was getting per-layer resolutions arrays like:
0: 14.111103491115225
1: 10.423086192640271
2: 7.698953228400015
3: 5.686787935702212
4: 4.200513506999054
5: 3.102685368608307
6: 2.2917808692998527
7: 1.692810881189884
8: 1.2503851122338436
9: 0.9235898388112184
10: 0.6822043720845288
11: 0.5039063724328983
12: 0.3722075708817364
13: 0.2749290014984501
14: 0.2030747404892286
15: 0.1500000000000001
And for index 15 the effect of the roundoff error is obvious. Solution
was to explicitly set
resolutions[numZoomLevels-1] = minResolution;
After the fix, layers remain visible at the most zoomed-in level.
Possibly one might want to do the symmetric thing for maxResolutions.
-Dave
Index: lib/OpenLayers/Layer.js
===================================================================
--- lib/OpenLayers/Layer.js (revision 10897)
+++ lib/OpenLayers/Layer.js (working copy)
@@ -1003,9 +1003,10 @@
var i;
if(typeof maxResolution === "number") {
- for(i=0; i<numZoomLevels; i++) {
+ for(i=0; i<numZoomLevels - 1; i++) {
resolutions[i] = maxResolution / Math.pow(base, i);
}
+ resolutions[numZoomLevels-1] = minResolution;
} else {
for(i=0; i<numZoomLevels; i++) {
resolutions[numZoomLevels - 1 - i] =
_______________________________________________
Dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-dev