From c33aab8dae5ff693bab2095a8b553527aa91110d Mon Sep 17 00:00:00 2001 From: smikhailov Date: Wed, 17 Apr 2024 10:51:00 +0500 Subject: [PATCH 1/2] Trim PBF file with poly while downloading --- Dockerfile | 1 + run.sh | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 883248f6..dac43ea3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -68,6 +68,7 @@ RUN apt-get update \ mapnik-utils \ npm \ osm2pgsql \ + osmctools \ osmium-tool \ osmosis \ postgresql-$PG_VERSION \ diff --git a/run.sh b/run.sh index ddd9af9b..dd60a9e5 100755 --- a/run.sh +++ b/run.sh @@ -67,12 +67,18 @@ if [ "$1" == "import" ]; then DOWNLOAD_POLY="https://download.geofabrik.de/europe/luxembourg.poly" fi + if [ -n "${DOWNLOAD_POLY:-}" ]; then + echo "INFO: Download PBF-POLY file: $DOWNLOAD_POLY" + wget ${WGET_ARGS:-} "$DOWNLOAD_POLY" -O /data/region.poly + fi + if [ -n "${DOWNLOAD_PBF:-}" ]; then echo "INFO: Download PBF file: $DOWNLOAD_PBF" - wget ${WGET_ARGS:-} "$DOWNLOAD_PBF" -O /data/region.osm.pbf - if [ -n "${DOWNLOAD_POLY:-}" ]; then - echo "INFO: Download PBF-POLY file: $DOWNLOAD_POLY" - wget ${WGET_ARGS:-} "$DOWNLOAD_POLY" -O /data/region.poly + if [ -f /data/region.poly ]; then + wget ${WGET_ARGS:-} "$DOWNLOAD_PBF" -O - | osmconvert - -B=/data/region.poly -o=/data/region.osm.pbf + chown renderer: /data/region.osm.pbf + else + wget ${WGET_ARGS:-} "$DOWNLOAD_PBF" -O /data/region.osm.pbf fi fi From 71223b9c99a5cf79f85b082ed3fe1ddb2b552e95 Mon Sep 17 00:00:00 2001 From: Tysacheglaz <8859268+Tysacheglaz@users.noreply.github.com> Date: Thu, 18 Apr 2024 09:26:16 +0500 Subject: [PATCH 2/2] Update run.sh Co-authored-by: Robin C. Ladiges --- run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run.sh b/run.sh index dd60a9e5..ec08600b 100755 --- a/run.sh +++ b/run.sh @@ -76,10 +76,10 @@ if [ "$1" == "import" ]; then echo "INFO: Download PBF file: $DOWNLOAD_PBF" if [ -f /data/region.poly ]; then wget ${WGET_ARGS:-} "$DOWNLOAD_PBF" -O - | osmconvert - -B=/data/region.poly -o=/data/region.osm.pbf - chown renderer: /data/region.osm.pbf else wget ${WGET_ARGS:-} "$DOWNLOAD_PBF" -O /data/region.osm.pbf fi + chown renderer: /data/region.osm.pbf fi if [ "${UPDATES:-}" == "enabled" ] || [ "${UPDATES:-}" == "1" ]; then