-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload_Stage3.sh
executable file
·51 lines (42 loc) · 1.35 KB
/
upload_Stage3.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
set -e
mkdir -p uploadLog
IMPORT_DOC="https://wiki.openstreetmap.org/wiki/Imports/Vicmap_Address"
i=0
totalFiles=`ls -1 dist/candidates/newAddressesInBlocksWithoutAnyExisting/*.osm | wc -l`
categoryMessage="New addresses in blocks without any existing addresses"
stage="Stage 3"
DONE=dist/candidates/newAddressesInBlocksWithoutAnyExisting/_DONE
mkdir -p "$DONE"
for f in dist/candidates/newAddressesInBlocksWithoutAnyExisting/*.osm; do
i=$(($i + 1))
d=`dirname "$f"`
b=`basename "$f" .osm`
id=`echo "$b" | cut -d'_' -f1`
name=`echo "$b" | cut -d'_' -f2`
echo "$i/$totalFiles $id: $name"
echo " to osc"
./upload/osm2change.py "$f"
if [ ! -e "$d/$b.osc" ] ; then
echo "$d/$b.osc not found"
echo '$f' >> uploadLog/oscNotFound.txt
else
echo " upload"
./upload/upload.py \
-u 'vicmap_import' \
-p "${OSM_PASSWORD}" \
-c yes \
-m "Vicmap Address Import - $stage - $categoryMessage: $name. See $IMPORT_DOC" \
-y 'Vicmap Address' \
"$d/$b.osc"
echo "$f" >> uploadLog/uploaded.txt
mv "$f" "$DONE/"
mv "$d/$b.osc" "$DONE/"
mv "$d/$b.diff.xml" "$DONE/"
mv "$d/$b.geojson" "$DONE/"
fi
# give the api a rest
sleep 1s
# stop after first, used during testing
# exit
done