Reputation: 275
I use the Overpass API to get the streets and public places of Budapest. I used the following query to get it:
<union>
<area-query ref="3600037244"/>
<recurse type="node-relation" into="rels"/>
<recurse type="node-way"/>
<recurse type="way-relation"/>
</union>
<print mode="body"/>
It looks usable, but I need the city districts too. I have found that the city districts are in the addressparts here: http://nominatim.openstreetmap.org/reverse?format=xml&lat=47.4959374&lon=19.1174585&zoom=18&addressdetails=1 How can I get this data for all the places I downloaded from the original query?
Upvotes: 2
Views: 5506
Reputation: 3668
Please check the following description on how to add city/county details to each information signpost:
This works with is_in but is also geared towards handling a larger number of objects by using foreach.
Upvotes: 0
Reputation: 31
You can use Overpass API 0.7 to get areas to which point belongs (is_in) check example for the same coordinates: http://overpass-api.de/api/interpreter?data=is_in(47.4959374,19.1174585);out; It's even more precise - as nominatim tries to find nearest building and uses it as a reference point.
Upvotes: 0
Reputation: 21469
You can' retrieve this information via the Overpass API because this API is only for downloading raw and unprocessed geodata from OpenStreetMap. But in order to determine which street and place belongs to which district geocoding is required.
You already figured out that Nominatim offers (reverse) geocoding, but only for a single address or a single coordinate at a time. You have to run a query for each street and each place individually. But this will get you into troubles because it doesn't comply with the usage policy of OSM's official Nominatim instance which runs on funded servers. There are two options: Either choose another instance, for example the Nominatim instance provided by MapQuest, or install your local Nominatim instance.
Another possibility would be to get all boundary=administrative relations in Budapest (for example via the Overpass API) and do the geocoding yourself. But note that this requires some thinking and post-procession because a single street can be part of multiple districts.
Upvotes: 3