-
Notifications
You must be signed in to change notification settings - Fork 7
/
build-1-get-sources.sh
executable file
·81 lines (70 loc) · 1.71 KB
/
build-1-get-sources.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
force=0
echo "Where files EXIST -- please remove manually to refresh."
echo
echo
echo "Download NGA Geonames - World"
echo "==============================="
FILE=Whole_World.7z
TEST=tmp/$FILE
if [ ! -f "$TEST" ]; then
curl -k https://geonames.nga.mil/geonames/GNSData/fc_files/$FILE -o $TEST
else
echo "EXISTS $TEST"
fi
TARGET=./tmp/Whole_World.txt
if [ -f "$TEST" -a ! -e $TARGET ]; then
echo "Unpacking $TEST"
# On Mac: 7zz; On Ubuntu: 7za
UNZIP=7zz
rm $TARGET
$UNZIP e -so $TEST | grep -v "The geographic names in this database" > $TARGET
echo "NGA Geonames file is at $TARGET"
else
echo "EXISTS $TARGET ?"
fi
echo
echo
echo "Download USGS National File"
echo "==============================="
USGS_PRODDATE=20210825
FILE=NationalFile.zip
TEST=tmp/$FILE
if [ ! -f "$TEST" ]; then
curl -k "https://geonames.usgs.gov/docs/stategaz/$FILE" -o $TEST
else
echo "EXISTS $TEST"
fi
TARGET=./tmp/NationalFile.txt
if [ -f "$TEST" -a ! -e $TARGET ]; then
echo "Unpacking $TEST"
UNZIP=unzip
$UNZIP -d ./tmp $TEST
mv ./tmp/NationalFile_${USGS_PRODDATE}* $TARGET
echo "USGS file is at $TARGET"
else
echo "EXISTS $TARGET ?"
fi
echo
echo
echo "==============================="
echo "Download HumData Exchange - PAK"
echo "==============================="
FILE=pak_adm_wfp_20220909_shp.zip
TEST=tmp/$FILE
if [ ! -f "$TEST" ]; then
echo "Download https://data.humdata.org/dataset/cod-ab-pak"
echo " grab FILE $FILE"
echo " copy to ./tmp/ here"
echo "READY?"
read ans
if [ "$ans" = "y" -a -f "$TEST" ]; then
echo "Continuing ... "
unzip -d tmp/pak_adm_wfp $TEST
else
echo "File not found"
fi
fi
if [ -f $TEST ]; then
unzip -d ./tmp/pak_adm_wfp/ $TEST
fi