]> git.openstreetmap.org Git - rails.git/commitdiff
Use Math.PI instead of defining it ourselves (and sometimes forgetting).
authorTom Hughes <tom@compton.nu>
Sat, 30 Jun 2007 11:25:53 +0000 (11:25 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 30 Jun 2007 11:25:53 +0000 (11:25 +0000)
public/javascripts/map.js

index c9e9b504cc82a45b20960511838f86755e6c2634..71f5b8ff8be18845881b77dab4db62fc4c53e2ae 100644 (file)
@@ -99,16 +99,15 @@ function removeMarkerFromMap(marker){
 function mercatorToLonLat(merc) {
    var lon = (merc.lon / 20037508.34) * 180;
    var lat = (merc.lat / 20037508.34) * 180;
-   var PI = 3.14159265358979323846;
 
-   lat = 180/PI * (2 * Math.atan(Math.exp(lat * PI / 180)) - PI / 2);
+   lat = 180/Math.PI * (2 * Math.atan(Math.exp(lat * Math.PI / 180)) - Math.PI / 2);
 
    return new OpenLayers.LonLat(lon, lat);
 }
 
 function lonLatToMercator(ll) {
    var lon = ll.lon * 20037508.34 / 180;
-   var lat = Math.log(Math.tan((90 + ll.lat) * PI / 360)) / (PI / 180);
+   var lat = Math.log(Math.tan((90 + ll.lat) * Math.PI / 360)) / (Math.PI / 180);
 
    lat = lat * 20037508.34 / 180;