-
-
Save mdeweerd/9bc5f60f2d6733e907f3 to your computer and use it in GitHub Desktop.
#!/bin/bash -xv | |
### Country list | |
# CHANGE WITH YOUR COUNTRIES | |
COUNTRIES="europe/france/guadeloupe europe/france/guyane europe/france/mayotte europe/france/martinique europe/france/reunion europe/france" | |
# SMALL SUBSET FOR TESTING: | |
COUNTRIES="europe/france/guyane europe/france/mayotte" | |
NOMINATIM="/var/www/Nominatim" | |
cd $NOMINATIM/data | |
INDEX=0 # false | |
### Foreach country check if configuration exists (if not create one) and then import the diff | |
for COUNTRY in $COUNTRIES; | |
do | |
DIR="$NOMINATIM/updates/$COUNTRY" | |
FILE="$DIR/configuration.txt" | |
if [ ! -f ${FILE} ]; | |
then | |
/bin/mkdir -p ${DIR} | |
/usr/bin/osmosis --rrii workingDirectory=${DIR}/. | |
/bin/echo baseUrl=http://download.geofabrik.de/${COUNTRY}-updates > ${FILE} | |
/bin/echo maxInterval = 0 >> ${FILE} | |
cd ${DIR} | |
/usr/bin/wget http://download.geofabrik.de/${COUNTRY}-updates/state.txt | |
fi | |
FILENAME=${COUNTRY//[\/]/_} | |
/usr/bin/osmosis --rri workingDirectory=${DIR}/. --wxc ${DIR}/${FILENAME}.osc.gz | |
### Foreach diff files do the import | |
cd ${NOMINATIM}/updates | |
# NEXT LINE MAY NOT BE NEEDED - FILE SEEMS EMPTY | |
LIST=$DIR/*.osc.gz | |
LIST2=*.osc.gz | |
LIST="$LIST $LIST2" | |
for OSC in $LIST; | |
do | |
if [ -f ${OSC} ]; | |
then | |
${NOMINATIM}/utils/update.php --import-diff ${OSC} --no-npi | |
rm ${OSC} | |
INDEX=1 | |
fi | |
done | |
done | |
### Re-index if needed | |
if ((${INDEX})); | |
then | |
${NOMINATIM}/utils/update.php --index | |
fi | |
### Remove all diff files | |
#rm -f ${NOMINATIM}/updates/*.osc.gz | |
#rm -f ${NOMINATIM}/updates/*/*.osc.gz | |
#rm -f ${NOMINATIM}/updates/*/*/*.osc.gz |
Today i had to do the same (set up multi-region Nominatim server) and i used your script as base for my setup. Thanks !
Changing into $NOMINATIM/data
is not neccessary and the "searching" for the osc.gz files seems a bit confusing, when i tried to understood the script. Since you know that the file is saved as ${DIR}/${FILENAME}.osc.gz
, you can just use that.
Saving all osc.gz files in the corresponding country directory made me prefer this script over the orginal one from openstreetmap/Nominatim#60, which just put all in the updates folder. But both approaches should work fine.
I forked your gist and changed it a bit to simplify it and support folders with spaces (https://gist.github.com/panpomaly/fb1881ffb127407a15549d60980accc5)
hi
I am using Nominatim 3.2.0, and according to instruction it's said that we don't need osmosis any more.
But if i want to update multi countries, this script from issue #60 is using this command /usr/bin/osmosis --rri workingDirectory=${DIR}/. --wxc ${DIR}/${FILENAME}.osc.gz
with cause error: osmosis not found.
So the question is: in case of update multi countries (which nominatim 3.2.0) i must install osmosis?
Thank for your help!
hi
I am using Nominatim 3.2.0, and according to instruction it's said that we don't need osmosis any more.
But if i want to update multi countries, this script from issue #60 is using this command
/usr/bin/osmosis --rri workingDirectory=${DIR}/. --wxc ${DIR}/${FILENAME}.osc.gz
with cause error: osmosis not found.So the question is: in case of update multi countries (which nominatim 3.2.0) i must install osmosis?
Thank for your help!
@casaulenbo: If you want to use this script, you need to install osmosis.
Here is a little update: https://gist.github.com/RhinoDevel/8a35ebd2a08166f328eca01ab005c6de
i can you give me the usages from this script? - but by me it don't work.
Using projection SRS 4326 (Latlong) Osm2pgsql failed due to ERROR: PREPARE get_classes (CHAR(1), int8) AS SELECT class FROM place WHERE osm_type = $1 and osm_id = $2 failed: ERROR: relation "place" does not exist LINE 1: ... get_classes (CHAR(1), int8) AS SELECT class FROM place WHER... ^ ERROR: Error from osm2pgsql, 1 Error from osm2pgsql, 1
thank you