]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/query.js
Simplify overpass query for nearby objects
[rails.git] / app / assets / javascripts / index / query.js
index d9906407d11ead6a476d1187025d14c874640922..8e0e0dae54147292fa7bb9933bd75f9424102343 100644 (file)
@@ -198,6 +198,13 @@ OSM.Query = function(map) {
             .text(I18n.t("javascripts.query.nothing_found"))
             .appendTo($ul);
         }
+      },
+      error: function(xhr, status, error) {
+        $section.find(".loader").stopTime("loading").hide();
+
+        $("<li>")
+          .text(I18n.t("javascripts.query." + status, { server: OSM.OVERPASS_URL, error: error }))
+          .appendTo($ul);
       }
     }));
   }
@@ -206,8 +213,10 @@ OSM.Query = function(map) {
     var latlng = L.latLng(lat, lng),
       radius = 10 * Math.pow(1.5, 19 - map.getZoom()),
       around = "around:" + radius + "," + lat + "," + lng,
-      features = "(node(" + around + ");way(" + around + ");relation(" + around + "))",
-      nearby = "((" + features + ";way(bn));node(w));out;",
+      nodes = "node(" + around + ")",
+      ways = "way(" + around + ");node(w)",
+      relations = "relation(" + around + ")",
+      nearby = "(" + nodes + ";" + ways + ";" + relations + ");out;",
       isin = "is_in(" + lat + "," + lng + ")->.a;(relation(pivot.a);way(pivot.a);node(w));out;";
 
     $("#sidebar_content .query-intro")