From acedcce53dfb1e2e295b4081bde424be7300485d Mon Sep 17 00:00:00 2001 From: Alexander Overvoorde Date: Thu, 20 Feb 2020 20:29:14 +0100 Subject: [PATCH] Improve consistency of parameter naming and document PBF/POLY download parameters --- README.md | 13 +++++++++++++ run.sh | 20 ++++++++++---------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 6cec73c..69ce0f7 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,19 @@ docker run \ Refer to the section *Automatic updating and tile expiry* to actually enable the updates while running the tile server. +### Letting the container download the file + +It is also possible to let the container download files for you rather than mounting them in advance by using the `DOWNLOAD_PBF` and `DOWNLOAD_POLY` parameters: + +``` +docker run \ + -e DOWNLOAD_PBF=http://download.geofabrik.de/europe/luxembourg-latest.osm.pbf \ + -e DOWNLOAD_POLY=http://download.geofabrik.de/europe/luxembourg.poly \ + -v openstreetmap-data:/var/lib/postgresql/12/main \ + overv/openstreetmap-tile-server \ + import +``` + ## Running the server Run the server like this: diff --git a/run.sh b/run.sh index 78505a6..dae1746 100755 --- a/run.sh +++ b/run.sh @@ -42,18 +42,18 @@ if [ "$1" = "import" ]; then setPostgresPassword # Download Luxembourg as sample if no data is provided - if [ ! -f /data.osm.pbf ] && [ -z "$DL_PBF" ]; then + if [ ! -f /data.osm.pbf ] && [ -z "$DOWNLOAD_PBF" ]; then echo "WARNING: No import file at /data.osm.pbf, so importing Luxembourg as example..." - DL_PBF="http://download.geofabrik.de/europe/luxembourg-latest.osm.pbf" - DL_PBF_POLY="http://download.geofabrik.de/europe/luxembourg.poly" + DOWNLOAD_PBF="http://download.geofabrik.de/europe/luxembourg-latest.osm.pbf" + DOWNLOAD_POLY="http://download.geofabrik.de/europe/luxembourg.poly" fi - - if [ -n "$DL_PBF" ]; then - echo "INFO: Download PBF file: $DL_PBF" - wget -nv "$DL_PBF" -O /data.osm.pbf - if [ -n "$DL_PBF_POLY" ]; then - echo "INFO: Download PBF-POLY file: $DL_PBF_POLY" - wget -nv "$DL_PBF_POLY" -O /data.poly + + if [ -n "$DOWNLOAD_PBF" ]; then + echo "INFO: Download PBF file: $DOWNLOAD_PBF" + wget -nv "$DOWNLOAD_PBF" -O /data.osm.pbf + if [ -n "$DOWNLOAD_POLY" ]; then + echo "INFO: Download PBF-POLY file: $DOWNLOAD_POLY" + wget -nv "$DOWNLOAD_POLY" -O /data.poly fi fi