[OpenLayers-Trac] [OpenLayers] #3547: Map moveTo method breaks map in IE8/9 with large pans

OpenLayers trac-20090302 at openlayers.org
Wed Oct 12 00:36:40 EDT 2011

#3547: Map moveTo method breaks map in IE8/9 with large pans
 Reporter:  melanchthon      |       Owner:              
     Type:  bug              |      Status:  new         
 Priority:  trivial          |   Milestone:  2.12 Release
Component:  Map              |     Version:  2.10        
 Keywords:  moveTo, XYZ, IE  |       State:              
 When using an XYZ layer type in IE/8/9, the map breaks if user is zoomed
 to a high value and moves by a large amount, e.g. from one side of a
 continent to another.

 Using a spherical mercator projection, if the starting position is lon:
 lat: -4552140.78972385
 resolution: 0.5971642833709717

 and the code uses the setCenter method to move to
 lon: 12906516.013878
 lat: -3761098.874737

 the map appears as only a single tile in the LH top corner, or as 3 tiles
 on the LH side.

 The problem seems to be caused by the method used to reposition the map
 inside the moveTo method if the map doesn't zoom. Instead of rebuilding
 the grid, it uses css positioning:

 <div style="left: -5414874px; top: -1324695px; width: 256px; height:
 256px; overflow: hidden; position: absolute; z-index: 1;">

 I'm guessing that the problem is that the left and top values are too big
 for IE.

 This problem can be avoided by setting the forceZoom parameter to true,
 but this forces zoom events to fire, which is often not desirable.

 I encountered this issue in 2.10, but it exists in 2.11

 I have a workaround that involves always setting the zoomChanged variable
 to true in IE, but defining a variable called fakeZoom that tracks whether
 the user really zoomed, and using it to avoid triggering zoom events
 unnecessarily. However, it's just a hack.

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

More information about the Trac mailing list