[OpenLayers-Trac] [OpenLayers] #3485: Zoom level mismatch with Layer.Bing and overlays

OpenLayers trac-20090302 at openlayers.org
Fri Sep 2 12:40:37 EDT 2011


#3485: Zoom level mismatch with Layer.Bing and overlays
------------------------+---------------------------------------------------
 Reporter:  nrenner     |       Owner:  ahocever    
     Type:  bug         |      Status:  new         
 Priority:  major       |   Milestone:  2.11 Release
Component:  Layer.Bing  |     Version:  2.11 RC3    
 Keywords:              |       State:              
------------------------+---------------------------------------------------
 When adding an overlay to a map with Bing tiles as base layer, the two
 layers have different zoom levels. Tile request URLs for the overlay are
 calculated with the wrong zoom level and therefore the overlay doesn't
 align with the base map.

 A live example can viewed at:[[BR]]
 http://sautter.com/map/?zoom=4&lat=50.82333&lon=4.59951&layers=0000B00TFFFFFFFF

 To reproduce, add the following lines to examples/bing-tiles.js (tested
 with 2.11 RC3 on Windows XP with Firefox 6.0.1):

 {{{
   var osm = new OpenLayers.Layer.OSM();
   osm.isBaseLayer = false;
   osm.opacity = 0.5;
   map.addLayer(osm);
 }}}

 The OSM overlay gets initialized properly when debugging XYZ.getXYZ with a
 breakpoint at line 151:
 {{{
   this.map.getResolution() = 76.43702827453613
   this.map.getZoom() = 11
 }}}

 By adding the condition "z == 10" to the breakpoint, you can see that a
 refresh after the Bing initialization goes wrong because the zoom and
 resolution don't match:
 {{{
   this.map.getResolution() = 76.43702827453613
   this.map.getZoom() = 10
 }}}

 The reason seems to be, that within {{{Bing.initLayer}}}
 {{{Layer.getZoomForResolution}}} gets called, which determines the current
 zoom level based on the resolutions array. The Bing layer has a zoomOffset
 of 1, so in this case resolutions is only a subset of serverResolutions,
 thus the determined zoom level is relative to zoomOffset/maxResolution and
 doesn't fit to other layers with different settings.

 I think this was introduced with changeset:12106; with RC1 Bing worked OK
 with overlays, which are broken since RC2.

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


More information about the Trac mailing list