Skip to content

camptocamp/docker-nominatim

Repository files navigation

Docker image for Nominatim

Docker image for running OSM Nominatim backend.

The Image contains a nominatim backend installation that can be used to add/update data into a dedicated DB as well as serve a nominatim API. For detailed information see the official Nominatim releases or the nominatim code

This image does not provide a DB. The DB/DB server must be provided separately.

All regular nominatim settings can be set through environment variables file, see sample.env for a minimal example. For more details and nominatim specific parameters see the official documentation

The image can be used to:

  • run a nominatim API
  • create and load data into a dedicated DB
  • update a dedicated nominatim DB

The container will expose port 8080 by default.

Download the image

docker pull camptocamp/nominatim:latest

Populate the DB

Create a DB and Import data

Prerequisites

  • DB connection is correctly configured under NOMINATIM_DATABASE_DSN in the .env file
  • The user given in the connection above needs to be able to create a new DB (superuser)
  • A web user (read only user) exists in the DB cluster, configured under NOMINATIM_DATABASE_WEBUSER. And has the following rights:
    GRANT usage ON SCHEMA public TO rouser;
    GRANT SELECT ON ALL TABLES IN SCHEMA public TO rouser;
  • The DB used for nominatim does not yet exist

To create the DB and import the data use:

nominatim import --osm-file <osm data file>

This will create a new data base under the given connection. If the database already exists the command results in an error. Also this command requires supper user rights on the cluster so that a new data base can be created.

Import data into an existing empty DB without superuser rights on the DB

Prerequisites

    • DB connection is correctly configured under NOMINATIM_DATABASE_DSN in the .env file
  • The user given in the connection above needs owner right on the public schema (he will create the structure used for nominatim)

    GRANT CREATE ON SCHEMA public TO nominatim;
  • The web user (read only user) exists in the DB cluster NOMINATIM_DATABASE_WEBUSERthe

    GRANT usage ON SCHEMA public TO rouser;
    GRANT SELECT ON ALL TABLES IN SCHEMA public TO rouser;
  • The DB must exists with the following extensions activated:

    CREATE EXTENSION IF NOT EXISTS postgis;
    CREATE EXTENSION IF NOT EXISTS hstore;
    CREATE EXTENSION IF NOT EXISTS postgis_raster

To create the necessary tables and import data run:

nominatim import --continue import-from-file --osm-file <osm data file>

This command will run all the necessary steps to have a functional nominatim DB except create a new DB

If this command returns an error after having create the DB tables re-start the import using a different flavour of --continue. For more options check nominatim import --help

Update existing date or import further data

Note

Locally this tends to take much longer than importing data on setup.

Prerequisites

  • The DB has to exist and is accessible under the value defined for the env variable NOMINATIM_DATABASE_DSN
  • The DB has to have the basic structure required for nominatim

Run the command

# load the data
nominatim add-data --file <osm data file>
# rerun the indexing
nominatim index

About

Docker image for running OSM Nominatim backend

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published