Ticket #2872 (closed bug: duplicate)
Correct Longitude Labels on Grid Layer across dateline
| Reported by: | cayenne | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 2.11 Release |
| Component: | Util | Version: | 2.11 RC1 |
| Keywords: | grid, longitude | Cc: | |
| State: |
Description
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;}
Change History
Note: See
TracTickets for help on using
tickets.
