[OpenLayers-Trac] [OpenLayers] #2872: Correct Longitude Labels on
Grid Layer across dateline
OpenLayers
trac-20090302 at openlayers.org
Mon Oct 11 22:16:20 EDT 2010
#2872: Correct Longitude Labels on Grid Layer across dateline
-----------------------------+----------------------------------------------
Reporter: cayenne | Owner:
Type: bug | Status: new
Priority: minor | Milestone: 2.11 Release
Component: Util | Version: 2.10
Keywords: grid, longitude | State:
-----------------------------+----------------------------------------------
When applying the OpenLayers.Control.Graticule to a map that wraps around
the dateline (180 degrees east or west), if you drag the map past the
dateline, you get incorrect labels like 200W, which should be 160E.
This is wrong, but both minor and easily fixed.
In the OpenLayers.Util.getFormattedLonLat module, insert the following
line:
'''coordinate = (coordinate+540)%360 - 180; // normalize for sphere
'''
This code will take any value over 180 and wrap it around. This is still
not quite right for latitude with a horribly incorrect value above 90, so
we can wrap it in a
'''if(axis='lon'){coordinate = (coordinate+540)%360 - 180;}'''
--
Ticket URL: <http://trac.openlayers.org/ticket/2872>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer
More information about the Trac
mailing list