Venturing around in the OpenLayers source code, it seems like everything related to zoom-levels is done using resolutions. Fair enough since this related directly to screen space.
I would like though, to use scales instead, and further more explicitly define the allowed scales.
- Is this possible?
So far I have created a set of scales which I transform into resolutions:
var scales = [500, 1000, 2000, 4000, 10000, 25000, 50000];
var resolutions = [];
for(var i = 0; i < scales.length; i++) {
resolutions.push(OpenLayers.Util.getResolutionFromScale(scales[i], units));
}
map = new OpenLayers.Map('', {
...
minScale: scales[scales.length - 1],
maxScale: scales[0],
resolution: resolutions,
numZoomLevels: scales.length,
...
});
My problem is that the first and the last scale are respected, but in between the current resolution converted into scale is not among the ones I specified.
- What have I missed?
