Skip to content

Nominatim should index features by boundary relations #693

Closed

Description

@1ec5

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.

Activity

  1. 1ec5 commented on Feb 7, 2025

    @1ec5
    MemberAuthor

    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.

  2. added theissue type on Mar 16, 2025
  3. 1ec5 commented on May 22, 2025

    @1ec5
    MemberAuthor

    Due to a series of unfortunate events, the entirety of Czechia is currently associated with Nazi Germany. 😬

  4. Rub21 commented on Jul 10, 2026

    @Rub21
    Member

    I fixed this issue:

    • 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.

    I have moved the address-levels.json file in ohm-deploy repo as well, e.g https://github.com/OpenHistoricalMap/ohm-deploy/tree/staging/images/nominatim

  5. Rub21 commented on Jul 10, 2026

    @Rub21
    Member

    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.

  6. 1ec5 commented on Jul 15, 2026

    @1ec5
    MemberAuthor

    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:

  7. Rub21 commented on Jul 20, 2026

    @Rub21
    Member

    Closing this ticket , since this issue is deploy in production!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions