3 # Derived from https://gist.github.com/RhinoDevel/8a35ebd2a08166f328eca01ab005c6de and edited to work with Pyosmium
4 # Related to https://github.com/osm-search/Nominatim/issues/1683
6 # Steps being followed:
8 # *) Get the diff file from server
9 # 1) pyosmium-get-changes (with -f sequence.state for getting sequenceNumber)
12 # 1) utils/update.php --import-diff
14 # *) Index for all the countries at the end
18 # Use "bashdb ./update_database.sh" and bashdb's "next" command for step-by-step
21 # ******************************************************************************
23 # REPLACE WITH LIST OF YOUR "COUNTRIES":
27 COUNTRIES="europe/monaco europe/andorra"
29 # SET TO YOUR NOMINATIM build FOLDER PATH:
31 NOMINATIMBUILD="/srv/nominatim/build"
32 UPDATEFILE="$NOMINATIMBUILD/utils/update.php"
34 # SET TO YOUR update data FOLDER PATH:
36 UPDATEDIR="/srv/nominatim/update"
38 UPDATEBASEURL="https://download.geofabrik.de"
39 UPDATECOUNTRYPOSTFIX="-updates"
41 # If you do not use Photon, let Nominatim handle (re-)indexing:
43 FOLLOWUP="$UPDATEFILE --index"
45 # If you use Photon, update Photon and let it handle the index
46 # (Photon server must be running and must have been started with "-database",
47 # "-user" and "-password" parameters):
49 #FOLLOWUP="curl http://localhost:2322/nominatim-update"
51 # ******************************************************************************
54 for COUNTRY in $COUNTRIES;
57 echo "===================================================================="
59 echo "===================================================================="
60 DIR="$UPDATEDIR/$COUNTRY"
61 FILE="$DIR/sequence.state"
62 BASEURL="$UPDATEBASEURL/$COUNTRY$UPDATECOUNTRYPOSTFIX"
63 FILENAME=${COUNTRY//[\/]/_}
68 echo "Attempting to get changes"
69 pyosmium-get-changes -o ${DIR}/${FILENAME}.osc.gz -f ${FILE} --server $BASEURL -v
71 echo "Attempting to import diffs"
72 ${NOMINATIMBUILD}/utils/update.php --import-diff ${DIR}/${FILENAME}.osc.gz
73 rm ${DIR}/${FILENAME}.osc.gz
77 echo "===================================================================="
80 echo "===================================================================="