Skip to content

Using Nominatim with data from OHM #455

Closed
Closed

Description

@lonvia

OHM data breaks with a very fundamental assumption of Nominatim, namely that there is only one version of every place. It's still usable but comes completely without warranties like this. Here are some hints how to configure/tweak Nominatim for reference.

Disable address computation

Normally Nominatim computes an address from the boundaries it finds in the data. This process becomes a bit random when there are multiple versions of a boundary. You can disable most of the address computation by marking most data as 'not usable as an address item'. Here is an appropriate config file for that: address-levels.json . Simple drop it into your project directory.

Fun fact: address items will still be added when an object has an is_in:* tag and there is a place= node with the same name around. That might be a way to manually create the address hierarchies as needed.

Customize country layout

Places are always assigned to countries. This is hard-coded and cannot be changed. You can however change the definition of the countries used. The geometries comes from data/country_osm_grid.sql.gz which is a gzipped SQL dump of the table country_osm_grid. Yo could come up with your own country divisions, create a table with the same layout from them and replace the country_osm_grid.sql.gz file. You can also change the display and search names for countries by creating a custom country_settings.yaml file. See https://nominatim.org/release-docs/latest/customize/Country-Settings/ for more information.

Whatever you do with the countries, I recommend that you comment out updating country names. This is the code here lines 1119 to 1140.

Custom name tokenizers

For splitting of dates from names, have a look at strip_brace_terms.py as an example sanitizer. https://nominatim.org/tutorials/customize-transliteration.html explains how to deploy your own sanitizer.

Activity

  1. jeffreyameyer commented on Sep 23, 2022

    @jeffreyameyer
    Member

    Fun fact: address items will still be added when an object has an is_in:* tag and there is a place= node with the same name around. That might be a way to manually create the address hierarchies as needed.

    This is intriguing... definitely a nice way to opt in to a certain type of search results. I've heard of (not) tagging for the renderer, but this is the first time I've seen tagging for the search engine. I like it!

    Places are always assigned to countries. This is hard-coded and cannot be changed. You can however change the definition of the countries used.

    I'm worried about changing the definition of the countries, just b/c it's additional modifications to the mainline code in ways that could be hard to track once they deviate from current day. I wonder if it might be better to just add "Current day:" or something like that in front of the existing country designations.

    For splitting of dates from names,

    I do think we should include the dates with the names, in order to easily and quickly differentiate the various country borders from each other. Additional thoughts here from others would be very helpful.

  2. Rub21 commented on Sep 24, 2022

    @Rub21
    Member

    Thanks you for your help @lonvia about the rank configuration!! I have set up the new configuration 👇

    Here is an appropriate config file for that: address-levels.json . Simple drop it into your project directory.

    The new configuration is running in Staging: https://nominatim-ohm-staging.surge.sh/search.html?q=marino

    Production: https://nominatim-ohm-production.surge.sh/search.html?q=marino

    In both cases we are getting different results, looks we are getting more results in staging now, also for same boundary we are getting different rank results.

  3. Rub21 commented on Oct 13, 2022

    @Rub21
    Member

    I have made some updates in the nominatim container. basically, for running this part of the suggestion 👇

    Whatever you do with the countries, I recommend that you comment out updating country names. This is the code here lines 1119 to 1140.

    New docker configuration: https://github.com/developmentseed/osm-seed/blob/nominatim_admin/images/nominatim/Dockerfile.

    Also I found that updates just stopped sometimes, I have added some custom code to keep it updated programmatically every 10 minutes.

    About tokenizers, the sanitizer strip_brace_terms.py works fine to me, it is removing all dates under () from the name, here are the examples that I passed. also the script to test it locally
    https://gist.github.com/Rub21/dee7260973ffddefb0a60a3667b807d

    Those last changes are running in staging: https://nominatim-ohm-staging.surge.sh/search.html

    cc. @batpad @jeffreyameyer @danrademacher

  4. danrademacher commented on Jan 23, 2023

    @danrademacher

    At this point, I think we have made as many changes as we can in Nominatim configuration to improve results. we have separate tickets for other specific issues.

  5. added theissue type on Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions