-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgenKml.sh
More file actions
executable file
·53 lines (45 loc) · 894 Bytes
/
Copy pathgenKml.sh
File metadata and controls
executable file
·53 lines (45 loc) · 894 Bytes
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
#!/bin/bash
BASEDIR="/home/csam/fed2011"
KMLDIR="${BASEDIR}/kml"
if [ $# -lt 1 ]
then
echo "missing option..."
exit
elif [ $# -lt 2 ]
then
echo "missing year..."
exit
fi
opt=$1
year=$2
args=""
dir=${KMLDIR}/${year}/${opt}
mkdir -p ${dir}
case ${opt} in
conservative|liberal|ndp|bloc|green) args="-p $opt";;
turnout) args="-tn";;
esac
fednums="kmlall"
if [ ${opt} == "bloc" ]
then
fednums="kmlquebec"
fi
echo "fedpolls.py <id> -el $year $args"
while read i
do
if [ `grep $i ${BASEDIR}/kmlbig.txt | wc -l` -eq 1 ]
then
ww="-ww"
tol="-tol 0.0001"
else
ww=""
tol="-tol 0.0001"
fi
CMD="${BASEDIR}/fedpolls.py $i -el ${year} $ww $tol $args > ${dir}/$i.kml"
${BASEDIR}/fedpolls.py $i -el ${year} $ww $tol $args > ${dir}/$i.kml
echo $CMD
cd ${dir}
zip $i.kmz $i.kml
rm $i.kml
cd -
done < ${BASEDIR}/${fednums}.txt