]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index.js
Force coordinates into range for "Where am I" queries
[rails.git] / app / assets / javascripts / index.js
index 96e03539a08a4e245b3dafc51d5f094bc1bb75fb..cfee031fd47086d2c530da7a0e12bd6245a2e8cb 100644 (file)
@@ -334,9 +334,10 @@ $(document).ready(function () {
 
   $(".describe_location").on("click", function(e) {
     e.preventDefault();
-    var precision = OSM.zoomPrecision(map.getZoom());
+    var center = map.getCenter().wrap(),
+      precision = OSM.zoomPrecision(map.getZoom());
     OSM.router.route("/search?query=" + encodeURIComponent(
-      map.getCenter().lat.toFixed(precision) + "," +
-      map.getCenter().lng.toFixed(precision)));
+      center.lat.toFixed(precision) + "," + center.lng.toFixed(precision)
+    ));
   });
 });