[OpenLayers-Dev] Coordinate shift of ~150m after OpenLayers 2.10 upgrade to 2.11/2.12

Jay Parsons bbtt0 at verizon.net
Fri Mar 1 09:10:52 PST 2013


Hello,

We recently discovered an issue with coordinates being shifted by around 
150 m (500 ft) after upgrading from 2.10 to 2.11, and the problem still 
exists in 2.12.  The problem occurs in at least the latest Firefox and 
IE8/9.

I believe the problem must be in OpenLayers code because I can make this 
work or not work correctly by simply substituting OpenLayers 2.10 vs. 
2.11/2.12, with no changes to my application code.

This may or may not be the same issue as Ticket #3640 
(http://trac.osgeo.org/openlayers/ticket/3640) as there is not a lot of 
information given in that ticket, but the magnitude of the error and the 
direction of the offset look about the same.  That ticket may seem to 
suggest that the problem is specific to that type of map/application, so 
if it is the same problem perhaps this report will at least give you 
more information.

Positioning the mouse cursor over a particular intersection of roads on 
my map using first OpenLayers 2.10 and then again using 2.11 reveals:

39.24226, -77.32623  (OpenLayers 2.10)
39.24332, -77.32737  (OpenLayers 2.11)

Plugging the first numbers into Google Earth, they are correctly aligned 
with the roads.  The second numbers are shifted and incorrect.

Here is a page with a pair of screenshots that shows the issue for the 
intersection listed above:

http://71.178.253.249:8080/OpenLayers_issue_demo/OpenLayers_shift_results.html

Here are the demo web pages from which I took the screenshots above. 
These pages differ only by which version of OpenLayers they use:

http://71.178.253.249:8080/OpenLayers_issue_demo/MapTest_OpenLayers_2_10.html

http://71.178.253.249:8080/OpenLayers_issue_demo/MapTest_OpenLayers_2_11.html

Feel free to do a View->Source, as it is less than a couple hundred 
lines (some of which are comments or trivial code).

The code uses parameters from the tileset documented here (over which I 
have no control):

http://65.207.23.58/ArcGIS/rest/services/ChartBG_Cache/MapServer

There is one custom subclass of the XYZ layer type which is located in a 
separate Javascript file, but it too is small and fairly 
straightforward.  (You can do a View->Source of that too).  We had to 
subclass the XYZ layer because the tile origin was outside of the 
extents of the tiles, which the XYZ layer did not seem to support. 
Again this subclass has been working for a couple of years with 2.10.

I did a diff of the 2.10 and 2.11 source tree and spent a few hours 
trying to figure it out.  I suspect the issue may be related to the 
changes in Layer.getLonLatFromViewPortPx() but I tried reverting this 
function back to 2.10 and got a stack overflow error and at that point 
realized that I am not familiar enough with this code to know what I'm 
doing, and this would be hard for me to debug also since it is probably 
called a lot.

Any info or insight would be appreciated.  Thanks.

Jay


More information about the Dev mailing list