Skip to content

Instantly share code, notes, and snippets.

@roccostorm
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roccostorm/1b452ac6367b1cf662d5 to your computer and use it in GitHub Desktop.
Save roccostorm/1b452ac6367b1cf662d5 to your computer and use it in GitHub Desktop.
Query OSM via Overpass API to get all Nodes tagged with "vegan" in Dortmund (DE)
import overpy
api = overpy.Overpass()
q = """[out:json][timeout:25];
(
node["diet:vegan"="yes"](51.39,7.37,51.54,7.53);
way["diet:vegan"="yes"](51.39,7.37,51.54,7.53);
node["diet:vegan"="only"](51.39,7.37,51.54,7.53);
way["diet:vegan"="only"](51.39,7.37,51.54,7.53);
);
out body;
"""
result = api.query(q)
if len(result.nodes) > 0:
for node in result.nodes:
print(node.tags['name'])
if len(result.ways) > 0:
for way in result.ways:
print(way.tags['name'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment