Overpass query to use map precision
authormmd-osm <mmd.osm@gmail.com>
Wed, 21 Aug 2019 08:13:41 +0000 (10:13 +0200)
committermmd-osm <mmd.osm@gmail.com>
Wed, 21 Aug 2019 08:13:41 +0000 (10:13 +0200)
app/assets/javascripts/index/query.js

index 49d162b1f708252e6d227b524e0e2903bcd9ea7d..5c6e5817080efe09680a7dccb2564106efe28713 100644 (file)
@@ -284,7 +284,11 @@ OSM.Query = function (map) {
   function queryOverpass(lat, lng) {
     var latlng = L.latLng(lat, lng).wrap(),
         bounds = map.getBounds().wrap(),
-        bbox = bounds.getSouth() + "," + bounds.getWest() + "," + bounds.getNorth() + "," + bounds.getEast(),
+        precision = OSM.zoomPrecision(map.getZoom()),
+        bbox = bounds.getSouth().toFixed(precision) + "," +
+               bounds.getWest().toFixed(precision) + "," +
+               bounds.getNorth().toFixed(precision) + "," +
+               bounds.getEast().toFixed(precision),
         radius = 10 * Math.pow(1.5, 19 - map.getZoom()),
         around = "around:" + radius + "," + lat + "," + lng,
         nodes = "node(" + around + ")",