openlayers/openlayers — Issue #44: Remove all resolutions guessing
Author: tmcw
Created: 2011-11-09 03:14:37+00:00
State: open

Via this comment:

// ok we want resolutions, here's our strategy:
//
// 1. if resolutions are defined in the layer config, use them
// 2. else, if scales are defined in the layer config then derive
// resolutions from these scales
// 3. else, attempt to calculate resolutions from maxResolution,
// minResolution, numZoomLevels, maxZoomLevel set in the
// layer config
// 4. if we still don't have resolutions, and if resolutions
// are defined in the same, use them
// 5. else, if scales are defined in the map then derive
// resolutions from these scales
// 6. else, attempt to calculate resolutions from maxResolution,
// minResolution, numZoomLevels, maxZoomLevel set in the
// map
// 7. hope for the best!

This is the cause of 95% of help requests I see around OpenLayers. There should be two modes: calculate based on zoom levels, and give a specific set of resolutions. This guessing is just too much cognitive overhead and magic to be anywhere near predictable for implementations.