Hello. There are cities without relations. 'Search results' shows path of relations. How to get relation_ids from this path? For example I am looking for 'Wislon'. In Search results I see City: 'Wilson, Wilson County, North Carolina, United States of America', ie Wilson is part of Wilson County and Wilson County is part of North Carolina and so on. If I go to the details of the city (click the link), at the bottom of the page I see there is no any relation. How can I get relation_ids for Wilson County, North Carolina, United States of America? Usually I use http://www.openstreetmap.org/api/0.6/relation/relation_id, but this is not the case. As I can guess, this path is based on latitude\longitude of a place, and map\engine checks the next bigger territory untill the country level is reached. Is there any API call which I can use to get relation_ids of this tree? Thank you. asked 06 May '16, 22:42 bear_ukraine |
The county relation is available: http://www.openstreetmap.org/relation/2528757 To obtain the county relation from another object, you could synthesize a coordinate for the object (maybe the center or use some method to select a child node) and use reverse geocoding to obtain the admin hierarchy for that point. Nominatim and Overpass API both have support for such queries: http://wiki.openstreetmap.org/wiki/Nominatim#Reverse_Geocoding http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#Query_for_areas_.28is_in.29 answered 06 May '16, 23:08 maxerickson 1
Your information + some additional search + re-read few times Overpass API (lack of examples) and I have finally what I want :) Nominatim is cool thing, lots of example, but lack of functionality :) Here is the example of the solution: http://overpass-api.de/api/interpreter?data=rel(4084902);>;is_in;out; Also related info: http://help.openstreetmap.org/questions/20053/locating-an-osm-object-eg-finding-town-relation-name/20055
(07 May '16, 00:11)
bear_ukraine
|
Alternatively, you could go to http://nominatim.openstreetmap.org. Search for Wilson, pick the one you want, click on details and you get a page like http://nominatim.openstreetmap.org/details.php?place_id=144418235 On that page you will find all the links of the relations used by Nominatim to calculate the address. answered 07 May '16, 11:13 escada Wow. This method is also cool. Is there any way how can I get the data from details page via API?
(07 May '16, 13:22)
bear_ukraine
|