osm-rvb/import-osm-into-db.sh

35 lines
865 B
Bash

#!/bin/bash
#
echo "Started..."
#Started...
#
if [ $# -eq 0 ] ; then
echo 'Call ./<script> <db name>'
exit 1
fi
#
DB_NAME="$1"
echo "DB_NAME: $DB_NAME"
DB_USER=sib00_osmuser
echo "DB_USER: $DB_USER"
#
#delete all rows of the given table is faster with 'TRUNCATE' than with 'DELETE'
psql -c 'TRUNCATE planet_osm_line, planet_osm_point, planet_osm_polygon, planet_osm_roads;' -d $DB_NAME
#
#-d: database
vacuumdb -d $DB_NAME
#
#-d: database
#-C: size in MB for caching nodes
#-s: store temporary data in the database //TODO Why?
#-x: include attributes //TODO Why?
#-a: update existing osm2pgsql database with data from file //TODO Why? The db is cleaned in advance!
#-S: location of the style file
./osm2pgsql -d $DB_NAME -U $DB_USER /tmp/niedersachsen-latest.osm.pbf -S ./style_osm_20220601.style
#
#-d: database
reindexdb -d $DB_NAME
#
echo "Done."
#done.