[OpenLayers-Trac] Re: [OpenLayers] #2852: Bug in OpenLayers.Util.getFormattedLonLat

OpenLayers trac-20090302 at openlayers.org
Sun Oct 10 07:03:45 EDT 2010


#2852: Bug in OpenLayers.Util.getFormattedLonLat
----------------------+-----------------------------------------------------
 Reporter:  mattnott  |       Owner:              
     Type:  bug       |      Status:  new         
 Priority:  major     |   Milestone:  2.11 Release
Component:  Util      |     Version:  2.10        
 Keywords:            |       State:              
----------------------+-----------------------------------------------------

Comment(by mattnott):

 This is the fix I used. It ''works form me'' (TM)!!

 --- lib/OpenLayers/Util.js      (revision 10815)
 +++ lib/OpenLayers/Util.js      (working copy)
 @@ -1781,6 +1781,15 @@
      var coordinateseconds = (tempcoordinateminutes -
 coordinateminutes)/(1/60);
      coordinateseconds =  Math.round(coordinateseconds*10);
      coordinateseconds /= 10;
 +    if( coordinateseconds >= 60) {
 +       coordinateseconds -= 60;
 +        coordinateminutes += 1;
 +        if( coordinateminutes >= 60) {
 +            coordinateminutes -= 60;
 +            coordinatedegrees += 1;
 +            // What happens if we've now made coordinatedegrees > 180?
 +        }
 +    }

      if( coordinatedegrees < 10 ) {
          coordinatedegrees = "0" + coordinatedegrees;

-- 
Ticket URL: <http://trac.openlayers.org/ticket/2852#comment:2>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list