[OpenLayers-Commits] r11405 - in trunk/openlayers: lib/OpenLayers tests

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Thu Feb 24 06:24:50 EST 2011


Author: bartvde
Date: 2011-02-24 03:24:50 -0800 (Thu, 24 Feb 2011)
New Revision: 11405

Modified:
   trunk/openlayers/lib/OpenLayers/Util.js
   trunk/openlayers/tests/Util.html
Log:
OpenLayers.Util.getFormattedLonLat does not deal correctly with 60 seconds and 60 minutes, p=mattnott,jorix, r=me,marcjansen (closes #2852)

Modified: trunk/openlayers/lib/OpenLayers/Util.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Util.js	2011-02-24 11:22:49 UTC (rev 11404)
+++ trunk/openlayers/lib/OpenLayers/Util.js	2011-02-24 11:24:50 UTC (rev 11405)
@@ -1849,6 +1849,15 @@
     coordinateseconds =  Math.round(coordinateseconds*10);
     coordinateseconds /= 10;
 
+    if( coordinateseconds >= 60) { 
+        coordinateseconds -= 60; 
+        coordinateminutes += 1; 
+        if( coordinateminutes >= 60) { 
+            coordinateminutes -= 60; 
+            coordinatedegrees += 1; 
+        } 
+    }
+    
     if( coordinatedegrees < 10 ) {
         coordinatedegrees = "0" + coordinatedegrees;
     }

Modified: trunk/openlayers/tests/Util.html
===================================================================
--- trunk/openlayers/tests/Util.html	2011-02-24 11:22:49 UTC (rev 11404)
+++ trunk/openlayers/tests/Util.html	2011-02-24 11:24:50 UTC (rev 11405)
@@ -1101,6 +1101,12 @@
         t.eq(OpenLayers.Util.toFloat(b1), OpenLayers.Util.toFloat(b2),
             "toFloat rounds large floats correctly #2");
     }
+    function test_getFormattedLonLat(t) {
+        t.plan(1);
+        var z = 2 + (4/60) - 0.000002 ;
+        t.eq(OpenLayers.Util.getFormattedLonLat(z,"lon"), "02°04'00\"E",
+            "LonLat does not show 60 seconds.");
+    }
   </script>
 </head>
 <body>



More information about the Commits mailing list