From 31bf2d718b3260ecb9dc70ce2ae47a8cce7a6a16 Mon Sep 17 00:00:00 2001 From: Alexander Overvoorde Date: Tue, 20 Aug 2019 19:40:24 +0200 Subject: [PATCH] Add a way to enable options like --flat-nodes (fixes #53) --- README.md | 19 +++++++++++++++++++ run.sh | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f0d7433..495135b 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,7 @@ docker run \ -d overv/openstreetmap-tile-server \ run ``` + ### AUTOVACUUM The database use the autovacuum feature by default. This behavior can be changed with `AUTOVACUUM` environment variable. For example: @@ -105,6 +106,20 @@ docker run \ -d overv/openstreetmap-tile-server \ run ``` + +### Flat nodes + +If you are planning to import the entire planet or you are running into memory errors then you may want to enable the `--flat-nodes` option for osm2pgsql as follows: + +``` +docker run \ + -v /absolute/path/to/luxembourg.osm.pbf:/data.osm.pbf \ + -v openstreetmap-data:/var/lib/postgresql/10/main \ + -e OSM2PGSQL_EXTRA_ARGS=--flat-nodes \ + overv/openstreetmap-tile-server \ + import +``` + ### Benchmarks You can find an example of the import performance to expect with this image on the [OpenStreetMap wiki](https://wiki.openstreetmap.org/wiki/Osm2pgsql/benchmarks#debian_9_.2F_openstreetmap-tile-server). @@ -129,6 +144,10 @@ docker run \ ``` For too high values you may notice excessive CPU load and memory usage. It might be that you will have to experimentally find the best values for yourself. +### The import process unexpectedly exits + +You may be running into problems with memory usage during the import. Have a look at the "Flat nodes" section in this README. + ## License ``` diff --git a/run.sh b/run.sh index a3d552e..0abe64d 100755 --- a/run.sh +++ b/run.sh @@ -52,7 +52,7 @@ if [ "$1" = "import" ]; then fi # Import data - sudo -u renderer osm2pgsql -d gis --create --slim -G --hstore --tag-transform-script /home/renderer/src/openstreetmap-carto/openstreetmap-carto.lua -C 2048 --number-processes ${THREADS:-4} -S /home/renderer/src/openstreetmap-carto/openstreetmap-carto.style /data.osm.pbf + sudo -u renderer osm2pgsql -d gis --create --slim -G --hstore --tag-transform-script /home/renderer/src/openstreetmap-carto/openstreetmap-carto.lua -C 2048 --number-processes ${THREADS:-4} ${OSM2PGSQL_EXTRA_ARGS} -S /home/renderer/src/openstreetmap-carto/openstreetmap-carto.style /data.osm.pbf # Create indexes sudo -u postgres psql -d gis -f indexes.sql @@ -65,7 +65,7 @@ fi if [ "$1" = "run" ]; then # Clean /tmp rm -rf /tmp/* - + # Fix postgres data privileges chown postgres:postgres /var/lib/postgresql -R