6 if [[ ! -d "$INPATH" ]]; then
7 echo "input path does not exist"
11 if [[ ! -d "$OUTPATH" ]]; then
12 echo "output path does not exist"
16 INREGEX='_([0-9]{5})_edges.zip'
17 WORKPATH="$OUTPATH/tmp-workdir/"
22 INFILES=($INPATH/*.zip)
23 echo "Found ${#INFILES[*]} files."
25 for F in ${INFILES[*]}; do
28 if [[ "$F" =~ $INREGEX ]]; then
29 COUNTYID=${BASH_REMATCH[1]}
30 SHAPEFILE="$WORKPATH/$(basename $F '.zip').shp"
31 SQLFILE="$OUTPATH/$COUNTYID.sql"
33 unzip -o -q -d "$WORKPATH" "$F"
34 if [[ ! -e "$SHAPEFILE" ]]; then
35 echo "Unzip failed. $SHAPEFILE not found."
39 ./tiger_address_convert.py "$SHAPEFILE" "$SQLFILE"
45 OUTFILES=($OUTPATH/*.sql)
46 echo "Wrote ${#OUTFILES[*]} files."