From: mmd-osm Date: Wed, 21 Aug 2019 08:13:41 +0000 (+0200) Subject: Overpass query to use map precision X-Git-Tag: live~2373^2 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/549be4adbad7801fb4c78a66b23eb63c985b88a7 Overpass query to use map precision --- diff --git a/app/assets/javascripts/index/query.js b/app/assets/javascripts/index/query.js index 49d162b1f..5c6e58170 100644 --- a/app/assets/javascripts/index/query.js +++ b/app/assets/javascripts/index/query.js @@ -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 + ")",