MapComplete/scripts/osm2pgsql/update.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
873 B
Bash
Raw Normal View History

2024-03-28 10:37:58 +01:00
#! /bin/bash
2024-08-19 19:09:16 +02:00
# Full database update. DOwnload latest from planet.osm.org, build update script, setup and seed it
2024-03-28 10:43:58 +01:00
npm run init
npm run generate
npm run refresh:layeroverview
2024-03-28 10:37:58 +01:00
npm run generate:buildDbScript
mv build_db.sh ~/data/
2024-08-19 19:09:16 +02:00
TIMESTAMP=$(osmium fileinfo planet-latest.osm.pbf -g header.option.timestamp)
DATE=$(echo $TIMESTAMP | sed "s/T.*//")
vite-node scripts/osm2pgsql/createNewDatabase.ts -- ${DATE/T.*//}
cd ~/data || exit
rm planet-latest.osm.pbf
wget https://planet.osm.org/pbf/planet-latest.osm.pbf
rm seeddb.log
nohup osm2pgsql -O flex -S build_db.lua -s --flat-nodes=import-help-file -d postgresql://user:password@localhost:5444/osm-poi planet-latest.osm.pbf >> seeddb.log
# To see the progress
# tail -f seeddb.log
# Restart tileserver
export DATABASE_URL=postgresql://user:password@localhost:5444/osm-poi.${DATE}
nohup ./pg_tileserv >> pg_tileserv.log &