Add a way to enable options like --flat-nodes (fixes #53)

This commit is contained in:
Alexander Overvoorde 2019-08-20 19:40:24 +02:00
parent fcc6168253
commit 31bf2d718b
2 changed files with 21 additions and 2 deletions

View File

@ -94,6 +94,7 @@ docker run \
-d overv/openstreetmap-tile-server \ -d overv/openstreetmap-tile-server \
run run
``` ```
### AUTOVACUUM ### AUTOVACUUM
The database use the autovacuum feature by default. This behavior can be changed with `AUTOVACUUM` environment variable. For example: 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 \ -d overv/openstreetmap-tile-server \
run 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 ### 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). 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. 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 ## License
``` ```

4
run.sh
View File

@ -52,7 +52,7 @@ if [ "$1" = "import" ]; then
fi fi
# Import data # 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 # Create indexes
sudo -u postgres psql -d gis -f indexes.sql sudo -u postgres psql -d gis -f indexes.sql
@ -65,7 +65,7 @@ fi
if [ "$1" = "run" ]; then if [ "$1" = "run" ]; then
# Clean /tmp # Clean /tmp
rm -rf /tmp/* rm -rf /tmp/*
# Fix postgres data privileges # Fix postgres data privileges
chown postgres:postgres /var/lib/postgresql -R chown postgres:postgres /var/lib/postgresql -R