Skip to content

Commit

Permalink
Configure DB connection
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardehrenfried committed Nov 18, 2024
1 parent e7d7f4b commit 46730cf
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions roles/poi/templates/import-pois
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
set -euo pipefail

CURL_OPTS="--location --fail -s --show-error -#"
WORKDIR=/var/poi/
POI_FILE="$WORKDIR/osm-pois.osm.pbf"

PBF_URL={{ poi_pbf_download_url }}
TMP_BUILD_DB="poi_next"

Expand All @@ -11,15 +14,14 @@ STADTNAVI_CONFIG_URL='https://docs.google.com/spreadsheets/d/1-iKEeaits4W1EPoMzI
# Download or update OSM data from Geofabrik
#

WORKDIR=/var/poi/

if [[ -e "$WORKDIR/osm-data.osm.pbf" ]]; then
pyosmium-up-to-date "$WORKDIR/osm-data.osm.pbf"
else
curl $CURL_OPTS -o "$WORKDIR/osm-data.osm.pbf" $PBF_URL
fi

osmium tags-filter --remove-tags --overwrite -o "$WORKDIR/osm-pois.osm.pbf" \
osmium tags-filter --remove-tags --overwrite -o $POI_FILE \
"$WORKDIR/osm-data.osm.pbf" \
amenity leisure office shop tourism landuse=cemetery natural=spring

Expand All @@ -32,4 +34,10 @@ curl --silent -o "$STADTNAVI_CONFIG" "$STADTNAVI_CONFIG_URL"

export LUA_PATH="$PROJECT_DIR/osm2pgsql-themepark/lua/?.lua;;"

osm2pgsql -d $TMP_BUILD_DB -O flex -S stadtnavi.lua "$DIR/osm-pois.osm.pbf"
osm2pgsql -d $TMP_BUILD_DB \
--port {{ poi_postgres_port }} \
--user poi \
--password {{ poi_postgres_password }} \
-O flex \
-S stadtnavi.lua \
$POI_FILE

0 comments on commit 46730cf

Please sign in to comment.