3

I have a locally hosted Nominatim service. I'm trying to reverse geocode a lat, lon to a place hierarchy.

E.g. https://nominatim.openstreetmap.org/search.php?q=30.284780%2C+-97.738831&viewbox=-126.57%2C51.68%2C126.57%2C-51.68

which returns https://nominatim.openstreetmap.org/details.php?place_id=93023332

How do I travel up the place hierarchy from http://www.openstreetmap.org/way/150732423 to http://www.openstreetmap.org/relation/1701848#map=12/30.3361/-97.7536 ?

4
+50

I guess the relationship is a bit tricky to discover. In fact i guess there is no relationship in the sense of OSM: I mean your building is not referenced as a member of the University of texas relation.

In a reproducible perspective, what you can do I such a case could be to perform an overpass query, based on the attribute fetched from the Nominatim reverse geocoding query. E.g. here Nominatim tells you that this building has university for value ? So lets perform a query to know which university it is :

[out:json];
(
  relation["amenity"="university"](around:5000,30.2814,-97.73883);
);
out body;
>;
out skel qt;

Request result on overpass turbo

Or you can perform a new Nominatim query, as previously, based on relevant attributes fetched from the first query (like University, Austin, Texas) and see if there is something interesting: Result on Nominatim

  • I'm going to accept this answer, however, I was hoping for a solution that didn't require search, because I'll have to do additional passes to determine which building lies inside which parent poi. – Rohan Monga Jan 31 '16 at 20:02
  • I have to admit that it isn't a full answer to your problem.. An other partial answer could be to look for tagging habits from OSM users and why not to contribute when you see things which could be improved ? There is some proposed (or already in use) manners to tag features belonging to a special site (like using operator = The University of Texas at Austin for your building i guess). See this page for ex. In some other sites (like rail stations i guess), some features are tagged as member of the "parent" relation. – mgc Feb 1 '16 at 22:08
2

Use Zoom Level in query to get to higher level.

e.g At level 18 this place gives way which is street

nominatim.openstreetmap.org/reverse?format=xml&lat=52.5487429714954&
lon=-1.81602098644987&zoom=18&addressdetails=1 

and at zoom level 8 this gives relation which corresponds to country

nominatim.openstreetmap.org/reverse?format=xml&lat=52.5487429714954&
lon=-1.81602098644987&zoom=8&addressdetails=1

Hierarcy

Zoom Level - Admin level
 2 - country
 4 - state
 5 - state_district
 6 -    
 7 - county
 8 - village
 9 - city_district
10 - suburb
  • right. But in my example I dont want to go up to "administrative levels". "Batts Hall" is a building inside "University of Texas, Austin". How do i discover that relationship? – Rohan Monga Jan 19 '16 at 4:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.