[OpenLayers-Trac] [OpenLayers] #3451: Rendering fails on setting minScale on Vector Layer with different Projection and Units as in the Map

OpenLayers trac-20090302 at openlayers.org
Fri Aug 5 10:53:45 EDT 2011


#3451: Rendering fails on setting minScale on Vector Layer with different
Projection and Units as in the Map
-------------------------------------------+--------------------------------
 Reporter:  mca                            |       Owner:  euzuro      
     Type:  bug                            |      Status:  new         
 Priority:  major                          |   Milestone:  2.11 Release
Component:  Layer                          |     Version:  2.10        
 Keywords:  Rendering, MinScale, MaxScale  |       State:              
-------------------------------------------+--------------------------------
 I tried to upgrade from 2.9.1 to 2.10 and wondered where my WFS Features
 were gone.
 Often you have a map with 900913 and a WFS Layer in 4326 which is
 requested in 4326 and automatically transformed to 900913 in the client.
 So far so good.
 I figures out that in OpenLayers.Layer.initResolutions() the resolutions
 are derived from minScale or maxScale if other properties aren't set:

 Line 946:
 if(this.options.minScale) {
             maxResolution = OpenLayers.Util.getResolutionFromScale(
                 this.options.minScale, this.units);
         }

 this calculation is based on this.units which is degree for the layer.

 Later these resolutions are compared with the map.resolution in the
 calculateInRange() Method which fails as we compare meters per pixel with
 degrees per pixel.

 A possible fix would be a change on initResolutions as follows
 (this.map.units instead of this.units):

 if(this.options.minScale) {
             maxResolution = OpenLayers.Util.getResolutionFromScale(
                 this.options.minScale, this.map.units);

 This should also be applied to the calculateResolutions-Method.
 It is the same in 2.11-rc1.

-- 
Ticket URL: <http://trac.openlayers.org/ticket/3451>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list