javascript - How to query Overpass area through leaflet? -


i have openstreetmap leaflet. i'm using this plugin leaflet query overpass.

var opl = new l.overpasslayer({   query: "(area['name'='roma']; node(area)['amenity'='drinking_water']);out;",   }); 

but map showing nothing when used plugin.

what wrong?

note: query working based on this.

edit:

this query working plugin not on http://overpass-turbo.eu/ ?!

var opl = new l.overpasslayer({ query: "(node(bbox)['amenity'='drinking_water'];);out;", 

});

full example:

var attr_osm = 'map data &copy; <a href="http://openstreetmap.org/">openstreetmap</a> contributors', attr_overpass = 'poi via <a href="http://www.overpass-api.de/">overpass api</a>'; var osm = new l.tilelayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {opacity: 0.7, attribution: [attr_osm, attr_overpass].join(', ')});  var map = new l.map('map').addlayer(osm).setview(new l.latlng(49.592041, 8.648164),2);  //overpassapi overlay var opl = new l.overpasslayer({   query: "(node(bbox)['amenity'='drinking_water'];);out;",   });  map.addlayer(opl); 

your zoom level low, you're retrieving data large part of earth. consequence overpass query times out , won't result.

change

new l.latlng(49.592041, 8.648164),2)

to

new l.latlng(49.592041, 8.648164),14)

in addition recommended to:

  • add [timeout:x] parameter limit runtime of query
  • add maximum number of object want query, e.g. out 100; max. 100 nodes.

also, cannot use (bbox) in overpass turbo. correct syntax overpass turbo ({{bbox}}).


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -