34 lines
905 B
Bash
34 lines
905 B
Bash
#!/bin/bash
|
|
#
|
|
echo "Started..."
|
|
#Started...
|
|
#
|
|
# special variable $# is the number of arguments
|
|
if [ $# -lt 2 ] ; then
|
|
echo 'Call ./<script> <db name> <db user>'
|
|
exit 1
|
|
fi
|
|
#
|
|
DB_NAME="$1"
|
|
echo "DB_NAME: $DB_NAME"
|
|
DB_USER="$2"
|
|
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 -U $DB_USER
|
|
#
|
|
#
|
|
#-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 -U $DB_USER
|
|
#
|
|
echo "Done."
|
|
#done.
|