[OpenLayers-Trac] [OpenLayers] #1482: numZoomLevels from map overwritten with negative value in Layer.js

OpenLayers trac at openlayers.org
Wed Apr 2 16:18:56 EDT 2008


#1482: numZoomLevels from map overwritten with negative value in Layer.js
-----------------------+----------------------------------------------------
 Reporter:  pifpafpuf  |       Owner:  euzuro
     Type:  feature    |      Status:  new   
 Priority:  minor      |   Milestone:        
Component:  Layer      |     Version:  SVN   
 Keywords:             |       State:        
-----------------------+----------------------------------------------------
 This is against revision 6775 of Layer.js:

 In Layers.js:766 I get the error "invalid error length":

  confProps.resolutions = new Array(confProps.numZoomLevels);

 and confProps.numZoomLevels is -3 at that point.

 I traced this back to line 758 which, according to the comment just above
 seems to be wrong. I patched it as listed below and it works for me again.

 {{{
 --- Layer.js    (Revision 6775)
 +++ Layer.js    (Arbeitskopie)
 @@ -755,7 +755,7 @@
              // determine numZoomLevels if not already set on the layer
              // this gives numZoomLevels assuming approximately base 2
 scaling
              if (confProps.minResolution != null &&
 -                this.options.numZoomLevels == undefined) {
 +                confProps.numZoomLevels == undefined) {
                  var ratio = confProps.maxResolution /
 confProps.minResolution;
                  confProps.numZoomLevels =
                      Math.floor(Math.log(ratio) / Math.log(2)) + 1;
 }}}


 For the records: I am initializing the map with the following hand-crafted
 options:
 {{{
   controls: [new OpenLayers.Control.MouseDefaults()],
   maxExtent: new OpenLayers.Bounds(2476553.0, 5540279.0,
                                    2779499.0, 5856970.0),
   scales: [400, 500, 1000, 5000, 8000, 25000, 70000,
            150000, 300000, 500000, 1e6, 1.5e6],
   numZoomLevels: 8,
   projection: "EPSG:31466",
   units: 'm',
 }}}

 Cheers,
 Harald.

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


More information about the Trac mailing list