[OpenLayers-Dev] patch for layer disabled on highest zoom level
Dave Fuhry
dfuhry at gmail.com
Tue Feb 1 12:03:29 EST 2011
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: layer_disabled_lowest_zoom.v1.patch
Type: text/x-patch
Size: 633 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20110201/44c30edd/layer_disabled_lowest_zoom.v1.bin
More information about the Dev
mailing list