X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/16f5a5ac0c674b258996fcbde1c3fda2e651906a..be86e4824fe57c203c8916568527d38314d8423f:/app/assets/javascripts/index/query.js diff --git a/app/assets/javascripts/index/query.js b/app/assets/javascripts/index/query.js index 86f24e046..3a23993a6 100644 --- a/app/assets/javascripts/index/query.js +++ b/app/assets/javascripts/index/query.js @@ -2,7 +2,7 @@ OSM.Query = function(map) { var protocol = document.location.protocol === "https:" ? "https:" : "http:", - url = protocol + OSM.OVERPASS_URL, + 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'], marker; @@ -12,7 +12,7 @@ OSM.Query = function(map) { weight: 4, opacity: 1, fillOpacity: 0.5, - clickable: false + interactive: false }; queryButton.on("click", function (e) { @@ -146,7 +146,7 @@ OSM.Query = function(map) { if (feature.type === "node" && feature.lat && feature.lon) { geometry = L.circleMarker([feature.lat, feature.lon], featureStyle); - } else if (feature.type === "way" && feature.geometry) { + } else if (feature.type === "way" && feature.geometry && feature.geometry.length > 0) { geometry = L.polyline(feature.geometry.filter(function (point) { return point !== null; }).map(function (point) { @@ -179,7 +179,7 @@ OSM.Query = function(map) { url: url, method: "POST", data: { - data: "[timeout:5][out:json];" + query, + data: "[timeout:10][out:json];" + query, }, success: function(results) { var elements; @@ -226,6 +226,12 @@ OSM.Query = function(map) { } } + if (results.remark) { + $("
  • ") + .text(I18n.t("javascripts.query.error", { server: url, error: results.remark })) + .appendTo($ul); + } + if ($ul.find("li").length === 0) { $("
  • ") .text(I18n.t("javascripts.query.nothing_found"))