3 # Script to set up Nominatim database for multiple countries
 
   7 #     *) Get the pbf files from server
 
   9 #     *) Set up sequence.state for updates
 
  11 #     *) Setup nominatim db using 'setup.php --osm-file'
 
  15 # Use "bashdb ./update_database.sh" and bashdb's "next" command for step-by-step
 
  18 # ******************************************************************************
 
  20 touch2() { mkdir -p "$(dirname "$1")" && touch "$1" ; }
 
  22 # ******************************************************************************
 
  23 # Configuration section: Variables in this section should be set according to your requirements
 
  25 # REPLACE WITH LIST OF YOUR "COUNTRIES":
 
  27 COUNTRIES="europe/monaco europe/andorra"
 
  29 # SET TO YOUR replication server URL:
 
  31 BASEURL="https://download.geofabrik.de"
 
  32 DOWNCOUNTRYPOSTFIX="-latest.osm.pbf"
 
  34 # End of configuration section
 
  35 # ******************************************************************************
 
  38 IMPORT_CMD="nominatim import"
 
  46 for COUNTRY in $COUNTRIES;
 
  48     echo "===================================================================="
 
  50     echo "===================================================================="
 
  51     DIR="$UPDATEDIR/$COUNTRY"
 
  52     DOWNURL="$BASEURL/$COUNTRY$DOWNCOUNTRYPOSTFIX"
 
  53     IMPORTFILE=$COUNTRY$DOWNCOUNTRYPOSTFIX
 
  54     IMPORTFILEPATH=${UPDATEDIR}/tmp/${IMPORTFILE}
 
  56     touch2 $IMPORTFILEPATH
 
  57     wget ${DOWNURL} -O $IMPORTFILEPATH
 
  59     touch2 ${DIR}/sequence.state
 
  60     pyosmium-get-changes -O $IMPORTFILEPATH -f ${DIR}/sequence.state -v
 
  62     IMPORT_CMD="${IMPORT_CMD} --osm-file ${IMPORTFILEPATH}"
 
  64     echo "===================================================================="
 
  67 echo "===================================================================="
 
  68 echo "Setting up nominatim db"
 
  70 echo "===================================================================="