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

Robert Sanson Robert.Sanson at asurequality.com
Sun Mar 3 11:39:46 PST 2013

Sounds like a projection issue, perhaps related to a datum shift? If so, I would be looking at Proj definition files.

This is how I refer to proj files at the top of my Javascript code:

<script src="lib/proj4js-combined.js"></script>
<script src="lib/EPSG2193.js"></script>
<script src="lib/EPSG27200.js"></script>
<script src="lib/EPSG4326.js"></script>



>>> Jay Parsons <bbtt0 at verizon.net> 2/03/2013 6:10 a.m. >>>

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 

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: 

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

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): 

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.

Dev mailing list
Dev at lists.osgeo.org 

This email and any attachments are confidential and intended solely for the addressee(s). If you are not the intended recipient, please notify us immediately and then delete this email from your system.

This message has been scanned for Malware and Viruses by Websense Hosted Security.

More information about the Dev mailing list