X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/a47c0a4411825f48e447641094678b15df3b2f74..58e95f7ea46accda6359b187ce5936aad4ac5945:/app/assets/javascripts/index/query.js diff --git a/app/assets/javascripts/index/query.js b/app/assets/javascripts/index/query.js index cb76a3446..5c6e58170 100644 --- a/app/assets/javascripts/index/query.js +++ b/app/assets/javascripts/index/query.js @@ -1,6 +1,9 @@ //= require jquery.simulate +//= require querystring OSM.Query = function (map) { + var querystring = require("querystring-component"); + var url = OSM.OVERPASS_URL, queryButton = $(".control-query .control-button"), uninterestingTags = ["source", "source_ref", "source:ref", "history", "attribution", "created_by", "tiger:county", "tiger:tlid", "tiger:upload_uuid", "KSJ2:curve_id", "KSJ2:lat", "KSJ2:lon", "KSJ2:coordinate", "KSJ2:filename", "note:ja"], @@ -281,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 + ")", @@ -342,7 +349,7 @@ OSM.Query = function (map) { }; page.load = function (path, noCentre) { - var params = qs.parse(path.substring(path.indexOf("?") + 1)), + var params = querystring.parse(path.substring(path.indexOf("?") + 1)), latlng = L.latLng(params.lat, params.lon); if (!window.location.hash && !noCentre && !map.getBounds().contains(latlng)) {