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) nominatim add-data --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; do
44 echo "===================================================================="
46 echo "===================================================================="
47 DIR="$UPDATEDIR/$COUNTRY"
48 FILE="$DIR/sequence.state"
49 BASEURL="$UPDATEBASEURL/$COUNTRY$UPDATECOUNTRYPOSTFIX"
50 FILENAME=${COUNTRY//[\/]/_}
52 echo "Attempting to get changes"
53 rm -f ${DIR}/${FILENAME}.osc.gz
54 pyosmium-get-changes -o ${DIR}/${FILENAME}.osc.gz -f ${FILE} --server $BASEURL -v
56 echo "Attempting to import diffs"
57 nominatim add-data --diff ${DIR}/${FILENAME}.osc.gz
60 echo "===================================================================="
63 echo "===================================================================="