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":
25 COUNTRIES="europe/monaco europe/andorra"
27 UPDATEBASEURL="https://download.geofabrik.de"
28 UPDATECOUNTRYPOSTFIX="-updates"
30 # If you do not use Photon, let Nominatim handle (re-)indexing:
32 FOLLOWUP="nominatim index"
34 # If you use Photon, update Photon and let it handle the index
35 # (Photon server must be running and must have been started with "-database",
36 # "-user" and "-password" parameters):
38 #FOLLOWUP="curl http://localhost:2322/nominatim-update"
40 # ******************************************************************************
43 for COUNTRY in $COUNTRIES;
45 echo "===================================================================="
47 echo "===================================================================="
48 DIR="$UPDATEDIR/$COUNTRY"
49 FILE="$DIR/sequence.state"
50 BASEURL="$UPDATEBASEURL/$COUNTRY$UPDATECOUNTRYPOSTFIX"
51 FILENAME=${COUNTRY//[\/]/_}
53 echo "Attempting to get changes"
54 rm -f ${DIR}/${FILENAME}.osc.gz
55 pyosmium-get-changes -o ${DIR}/${FILENAME}.osc.gz -f ${FILE} --server $BASEURL -v
57 echo "Attempting to import diffs"
58 nominatim add-data --diff ${DIR}/${FILENAME}.osc.gz
61 echo "===================================================================="
64 echo "===================================================================="