Skip to content

Commit

Permalink
Add a way to enable options like --flat-nodes (fixes #53)
Browse files Browse the repository at this point in the history
  • Loading branch information
Overv committed Aug 20, 2019
1 parent fcc6168 commit 31bf2d7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 \

This comment has been minimized.

Copy link
@Istador

Istador Aug 20, 2019

Contributor

The --flat-nodes option is requiring a file path where to store the flat nodes file.
The file should be mounted as an additional volume, so that it isn't lost when recreating the container.

This comment has been minimized.

Copy link
@Overv

Overv Aug 22, 2019

Author Owner

Oops, serves me right for committing so carelessly. I've fixed (and tested) the example.

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).
Expand All @@ -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

```
Expand Down
4 changes: 2 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 31bf2d7

Please sign in to comment.