4

I need to figure out the process to load multiple OSM files into a Nominatim database. I have everything setup and can load a single file with no issues.

Basically what I'm trying to do is load some of the GeoFabrik OSM files for only a part of the world. So I'm grabbing like the North America and South America OSM files. Or any 2 on their site.

For the first load I use the setup.php:

./utils/setup.php --osm-file file.osm --all --osm2pgsql-cache 4000

I'm not sure if I have another file (file2.osm) how to load this into the database and keep the original data.

Basically, I just want pieces of the world and I only need to load data like every six months or so. I don't need daily updates/ etc...

I need to split the files up because it just takes too long to load and I want to manage it better.

Can I use the update.php..... But not sure what parameters.

I thought about loading all data with update and the no-index clause...Then maybe building the index??

I did try to re-run the setup.php for the second file but it just hung for a long time For second file

./utils/setup.php --import-data --osm-file file2.osm --osm2pgsql-cache 4000

But this just hangs on Setting up table: planet_osm_ways. (I tested very small OSM files that should finish within minutes but it just hangs).

The files that I'm using are all non-intersecting so not truly updates. SO I have a North America and a South America...How do I load both into Nominatim separately.

Thanks

scai
  • 20,297
  • 4
  • 56
  • 72
user2092856
  • 301
  • 5
  • 13

2 Answers2

3

The answer can be found at help.openstreetmap.org.

First you need to import it via the update script: ./utils/update.php --import-file <yourfile>. Then you need to trigger a re-indexing of the data: ./utils/update.php --index

But according to lonvia (one of the Nominatim developers) this will be very slow and it is better if you merge all your files first and then import it as one large file.

scai
  • 20,297
  • 4
  • 56
  • 72
3

Sample Merging Code, merging Andorra, Malta and Liechtenstein,

curl -L 'http://download.geofabrik.de/europe/andorra-latest.osm.pbf' --create-dirs -o /srv/nominatim/src/andorra.osm.pbf
curl -L 'http://download.geofabrik.de/europe/malta-latest.osm.pbf' --create-dirs -o /srv/nominatim/src/malta.osm.pbf
curl -L 'http://download.geofabrik.de/europe/liechtenstein-latest.osm.pbf' --create-dirs -o /srv/nominatim/src/liechtenstein.osm.pbf

osmconvert /srv/nominatim/src/andorra.osm.pbf -o=/srv/nominatim/src/andorra.o5m
osmconvert /srv/nominatim/src/malta.osm.pbf -o=/srv/nominatim/src/malta.o5m
osmconvert /srv/nominatim/src/liechtenstein.osm.pbf -o=/srv/nominatim/src/liechtenstein.o5m

osmconvert /srv/nominatim/src/andorra.o5m /srv/nominatim/src/malta.o5m /srv/nominatim/src/liechtenstein.o5m -o=/srv/nominatim/src/data.o5m

osmconvert /srv/nominatim/src/data.o5m -o=/srv/nominatim/src/data.osm.pbf;

More about OsmConvert -> https://wiki.openstreetmap.org/wiki/Osmconvert

Once merged, you can,

sudo -u nominatim /srv/Nominatim/build/utils/setup.php \
      --osm-file /srv/nominatim/src/data.osm.pbf \
      --all \
      --threads ${BUILD_THREADS} \ # 16 Threads?
      --osm2pgsql-cache ${OSM2PGSQL_CACHE}  # 24000 ?
MIdhun Krishna
  • 1,739
  • 1
  • 13
  • 31