]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/osm.js.erb
Read lat/lon attributes when generating context menu directions urls
[rails.git] / app / assets / javascripts / osm.js.erb
index e429f4479f143dfe2d50622b870d62d60558a263..e08528f845da2b2cee72780d3197720fbc42ab02 100644 (file)
@@ -204,7 +204,9 @@ OSM = {
   },
 
   zoomPrecision: function(zoom) {
-    return Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
+    var pixels = Math.pow(2, 8 + zoom);
+    var degrees = 180;
+    return Math.ceil(Math.log10(pixels / degrees));
   },
 
   locationCookie: function(map) {