Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geocodejson output: make sure a level is only printed once #3400

Conversation

mtmail
Copy link
Collaborator

@mtmail mtmail commented Apr 23, 2024

Another fix to #3382

Example:
curl 'https://nominatim.osm.org/reverse?lat=51.01762378&lon=-3.1520338&format=geocodejson' prints
[...]"admin":{"level10":"Bishop's Hull","level10":"Bradford-on-Tone","level6":"Som[...]

Browsers and Nominatim CLI handle duplicate keys by selecting the last occurrence ("Bradford-on-Tone") while the fix I added selects the first ("Bishop's Hull").

https://nominatim.openstreetmap.org/ui/details.html?osmtype=W&osmid=6011967
image

@mtmail mtmail requested a review from lonvia April 23, 2024 14:18
@lonvia
Copy link
Member

lonvia commented May 2, 2024

I don't think this is about first/last occurrence. We have a street here that goes through two admin_level=10 areas. You'd probably want to select one were the majority of the road is. Or for a house number, you'd want to select the one, it is actually in. It would be relatively expensive to do such a computation on admin_level level.

While I see that there is potentially a problem here, I'd file this particular example under data issue. Bishop's Hull is mapped as a suburb and even tagged with is_in=Tauton but the administrative boundary for Tauton disagrees and excludes Bishop's Hull. The result is that Bishop's Hull is a suburb without a city to be in. Upgrade Bishop's Hull to village and all is well.

@mtmail
Copy link
Collaborator Author

mtmail commented May 6, 2024

Thanks for pointers. Fixing the OSM data worked.

I saw a lot more places where this is happening but I'll keep the code fix in my local installation. We can review when somebody else reports the same issue. Probably my JSON parser (Perl) isn't modern enough.

@mtmail mtmail closed this May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants