I wish to get nodes that belong to a particular city. I tried doing a radius search around the latitude and longitude of the city but that is just an approximation. Moreover the radius varies from one city to another. Is there a good way to do this using Open Street Maps?
1 Answer
When there is a boundary relation for that city area (like political boundaries) you can use its name for a query via overpass-api or overpass-turbo.
So first find out about any good boundary relation within the OSM data: go to http://nominatim.openstreetmap.org and try to find a boundary relation for your city ... for example type "Buxtehude" in its search box there (Buxtehude is a small city in the north of Germany) ... see the results and its detail links.
With that background knowledge vidit http://overpass-turbo.eu and use its wizard modus: Try "shop=* in Buxtehude" there ... without ""
Thus you can limit any query via overpass-api or overpass-turbo (or even QuickOSM-Plugin in QGIS) to any city area as long as we have boundaries for that in the OSM data.
Please refer to the documentation of overpass-api and overpass turbo at wiki.osm.org
If you get stuck about a boundary is present or not, tell us the name of the city we can use for testing purposes.
Tell us here about success or failure in general.
-
1I found another solution to this problem - using area queries. Eg.
[out:json]; area[name = "New York"]; node(area)[amenity=bar]; out;
However the issue with this is that if I query the following:[out:json]; area[name = "New York"]; ( node(area)[amenity=bar]; node(area)[amenity=restaurant]; ); out;
The output includes only the first amenity, i.e. 'bar' even though there's a union. Any ideas? Commented Jun 21, 2015 at 5:50 -
I can confirm that your last query only returns bars, but no restaurants ... I have no knowledge whether there is an error in that query or a bug in overpass-api ... Tried to enter "amenity=bar or amenity=restaurent in XXX" in overpass-turbo-Wizard and it also gives only the bars and not the restaurants!!! Any experts here?????? Commented Jun 21, 2015 at 10:27
-
1@stephan75: I think you simply made a typo, it's restaurant, not restaurent. The same user created a new question for this topic: gis.stackexchange.com/questions/151702/…– mmdCommented Jun 21, 2015 at 18:38