-
Notifications
You must be signed in to change notification settings - Fork 7
/
build-3-sqlite-postal.sh
executable file
·61 lines (53 loc) · 1.72 KB
/
build-3-sqlite-postal.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
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
script=`dirname $0;`
basedir=`cd -P $script/..; echo $PWD`
XPONENTS=$basedir
export PYTHONPATH=$XPONENTS/python:$XPONENTS/piplib
export PYTHONUNBUFFERED=1
do_test=0
do_data=0
while [ "$1" != "" ]; do
case $1 in
'data')
do_data=1
shift
;;
'test')
do_test=1
shift
;;
esac
done
if [ "$do_data" -eq 1 ]; then
ant postal-sources
fi
if [ -d "./tmp/postal" ]; then
echo "Ready to Roll"
else
echo "Some files may be missing - Please check ./tmp/postal and make sure required files are unpacked"
ls -1 ./tmp/
exit 1
fi
if [ "$do_test" -eq 1 ] ; then
DB=./tmp/postal_test.sqlite
python3 ./script/postal.py ./tmp/postal/allCountries.txt 0 --db $DB --max 1000
python3 ./script/postal.py ./tmp/postal/CA_full.txt 2000000 --db $DB --max 1000 --country CA
python3 ./script/postal.py ./tmp/postal/NL_full.txt 3000000 --db $DB --max 1000 --country NL
python3 ./script/postal.py ./tmp/postal/GB_full.txt 4000000 --db $DB --max 1000 --country GB
python3 ./script/postal.py XX 6000000 --db $DB --max 1000 --copy-admin
else
# PRODUCTION
DB=./tmp/postal_gazetteer.sqlite
# start fresh:
rm -f $DB
echo POSTAL/GEONAMES `date`
python3 ./script/postal.py ./tmp/postal/allCountries.txt 0 --db $DB
echo POSTAL/CANADA `date`
python3 ./script/postal.py ./tmp/postal/CA_full.txt 2000000 --db $DB --country CA
echo POSTAL/NETHERLANDS `date`
python3 ./script/postal.py ./tmp/postal/NL_full.txt 3000000 --db $DB --country NL
echo POSTAL/UK `date`
python3 ./script/postal.py ./tmp/postal/GB_full.txt 4000000 --db $DB --country GB
echo POSTAL/ADMIN CODES `date`
python3 ./script/postal.py XX 6000000 --db $DB --copy-admin --optimize
fi