You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Nominatim should index features by boundary relations #693
Nominatim doesn’t appear to be indexing features based on the OpenHistoricalMap boundary relations that contain them. However, it does fall back to indexing places based on place points, which are often anachronistic. These fallbacks appear in the “address” that Nominatim generates for each result.
For example, if I search for “Tenochtitlan”, the first result is “Tenōchtitlan, México”. The Tenochtitlan node is located inside the Teotihuacán boundary relation, which Nominatim does index; however, Tenochtitlan’s “address” only includes Mexico, apparently based on this place node that’s a label within the Mexico boundary relation. That boundary relation is from a different time period, but at least indexing it by boundary would be preferable to falling back to the place node, which doesn’t make it easy to find the responsible feature.
This issue is more pronounced in some places where we’ve mapped more hierarchical boundaries. For example, the town of Jena was located in Thuringia, but its Nominatim address only mentions Germany. Many countries have multiple localities with the same name in different regions, so this issue makes it much harder to find a place, especially if the user has learned a habit of qualifying the place name with a region, as you often have to do for OpenStreetMap’s Nominatim instance.
OSM’s Nominatim instance definitely indexes places by boundary relation, so I’m unsure why this isn’t the case in OHM.
For example, if I search for “Tenochtitlan”, the first result is “Tenōchtitlan, México”. The Tenochtitlan node is located inside the Teotihuacán boundary relation, which Nominatim does index; however, Tenochtitlan’s “address” only includes Mexico, apparently based on this place node that’s a label within the Mexico boundary relation. That boundary relation is from a different time period, but at least indexing it by boundary would be preferable to falling back to the place node, which doesn’t make it easy to find the responsible feature.
The countries that Nominatim returns are actually coming from OpenStreetMap’s admin_level=2 boundary relations. For example, searching for “Coeur de Voh” returns a “Coeur de Voh, France” in present-day New Caledonia. No boundary of France has been mapped that includes New Caledonia. Rather, the search result is listed as coming from France because of OSM’s France relation that includes the French overseas territories.
Apparently Nominatim is falling back to a country grid derived from OSM when assigning each feature to a country. There’s nothing we can really replace this fallback with that makes perfect sense in OHM, because Nominatim fundamentally assumes that administrative boundaries form a tree (an assumption that sometimes even breaks down in OSM), whereas OHM’s form a polytree at best. We could generate a grid for OHM as of the present day, but it would be largely the same as the existing one.
#455 recommends disabling this functionality altogether. That would be unfortunate, since any context really helps to disambiguate similarly named results.
The cause In address-levels.json the address_rank was 0 for every admin boundary and most place types and rank of 0 tells Nominatim to skip the feature in the address hierarchy, so no region was ever attached and results fell back to the country, the geometries were fine, only the rank was wrong.
I set a nonzero address_rank for admin boundaries (administrative2–administrative12) and the main place types (country, state, region, county, city, town). I applied it with nominatim refresh --address-levels in production and a reindex , no reimport needed, since the rank is recomputed during indexing.
OpenHistoricalMap/ohm-deploy#809OpenHistoricalMap/ohm-deploy#810 has resulted in much improved behavior. I think most of what I’ve written in this issue is either mistaken or outdated at this point. I’ve opened the following issues to track the main problems that remain when it comes to boundaries:
Activity
1ec5 commentedon Feb 7, 2025
The countries that Nominatim returns are actually coming from OpenStreetMap’s
admin_level=2boundary relations. For example, searching for “Coeur de Voh” returns a “Coeur de Voh, France” in present-day New Caledonia. No boundary of France has been mapped that includes New Caledonia. Rather, the search result is listed as coming from France because of OSM’s France relation that includes the French overseas territories.Apparently Nominatim is falling back to a country grid derived from OSM when assigning each feature to a country. There’s nothing we can really replace this fallback with that makes perfect sense in OHM, because Nominatim fundamentally assumes that administrative boundaries form a tree (an assumption that sometimes even breaks down in OSM), whereas OHM’s form a polytree at best. We could generate a grid for OHM as of the present day, but it would be largely the same as the existing one.
#455 recommends disabling this functionality altogether. That would be unfortunate, since any context really helps to disambiguate similarly named results.
1ec5 commentedon May 22, 2025
Due to a series of unfortunate events, the entirety of Czechia is currently associated with Nazi Germany. 😬
Rub21 commentedon Jul 10, 2026
I fixed this issue:
The cause In
address-levels.jsontheaddress_rankwas0for every admin boundary and most place types and rank of0tells Nominatim to skip the feature in the address hierarchy, so no region was ever attached and results fell back to the country, the geometries were fine, only the rank was wrong.I set a nonzero
address_rankfor admin boundaries (administrative2–administrative12) and the main place types (country, state, region, county, city, town). I applied it withnominatim refresh --address-levelsin production and a reindex , no reimport needed, since the rank is recomputed during indexing.I have moved the
address-levels.jsonfile in ohm-deploy repo as well, e.g https://github.com/OpenHistoricalMap/ohm-deploy/tree/staging/images/nominatimRub21 commentedon Jul 10, 2026
My solution above, does not fix the wrong-country problem from this thread: https://forum.openhistoricalmap.org/t/inaccurate-countries-in-search-results/461, Nominatim does not know about dates, so it picks one boundary at random and often shows the wrong era , that needs a other changes.
1ec5 commentedon Jul 15, 2026
OpenHistoricalMap/ohm-deploy#809 OpenHistoricalMap/ohm-deploy#810 has resulted in much improved behavior. I think most of what I’ve written in this issue is either mistaken or outdated at this point. I’ve opened the following issues to track the main problems that remain when it comes to boundaries:
Rub21 commentedon Jul 20, 2026
Closing this ticket , since this issue is deploy in production!