-
Notifications
You must be signed in to change notification settings - Fork 370
/
run_all.sh
executable file
·170 lines (138 loc) · 9.52 KB
/
run_all.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/bin/bash
set -Eeuo pipefail
STARTDATE=$(date +"%Y-%m-%dT%H:%M%z")
runmode=${1-all}
# clean and recreate x_tempshape directory
rm -rf x_tempshape
mkdir -p x_tempshape
log_file=x_tempshape/run_all.log
##### backup log from here ...
exec &> >(tee -a "$log_file")
# Don't forget update the VERSION file!
echo "-----------------------------------"
echo "Runmode : $runmode"
echo "Version $(cat VERSION)"
echo "Start: $STARTDATE "
# Show some debug info
python3 ./tools/wikidata/platform_debug_info.py
# Summary Log file
logmd=x_tempshape/update.md
rm -f $logmd
# --------------------------------------------------------------------------------------------------------------------
# mode = fetch | write | fetch_write | copy | all
# LetterCase = uppercase --> variable names [WIKIDATAID, NAME_AR, NAME_BN, NAME_DE, NAME_EN, NAME_ES, ... ]
# LetterCase = lowercase --> variable names [wikidataid, name_ar, name_bn, name_de, name_en, name_es, ... ]
# --------------------------------------------------------------------------------------------------------------------
# | mode |LetterCase| shape_path | shape filename
# == 10m ================= |=========== |==========| ============| ================================================
function run10m {
./tools/wikidata/update.sh fetch_write uppercase 10m_cultural ne_10m_admin_0_sovereignty # this and other admin_0 run, but Mapshaper overwrites them
./tools/wikidata/update.sh fetch_write uppercase 10m_cultural ne_10m_admin_0_countries # instead results are copied into housekeeping file's lookup table
./tools/wikidata/update.sh fetch_write uppercase 10m_cultural ne_10m_admin_0_countries_lakes
./tools/wikidata/update.sh fetch_write uppercase 10m_cultural ne_10m_admin_0_map_units
./tools/wikidata/update.sh fetch_write uppercase 10m_cultural ne_10m_admin_0_map_subunits
./tools/wikidata/update.sh fetch_write uppercase 10m_cultural ne_10m_admin_0_disputed_areas
./tools/wikidata/update.sh fetch_write lowercase 10m_cultural ne_10m_admin_1_states_provinces # this and other admin_1 run, but Mapshaper overwrites them
./tools/wikidata/update.sh fetch_write lowercase 10m_cultural ne_10m_admin_1_states_provinces_lakes
./tools/wikidata/update.sh fetch_write lowercase 10m_cultural ne_10m_admin_1_label_points_details # Mapshaper uses this to generate admin_1 polys
./tools/wikidata/update.sh fetch_write uppercase 10m_cultural ne_10m_admin_2_label_points_details # Mapshaper uses this to generate admin_2 polys
./tools/wikidata/update.sh fetch_write uppercase 10m_cultural ne_10m_admin_2_counties # this and other admin_2 run, but Mapshaper overwrites them
./tools/wikidata/update.sh fetch_write uppercase 10m_cultural ne_10m_admin_2_counties_lakes
./tools/wikidata/update.sh fetch_write lowercase 10m_cultural ne_10m_airports
./tools/wikidata/update.sh fetch_write lowercase 10m_cultural ne_10m_populated_places # this should be build before derived Makefile themes run
./tools/wikidata/update.sh fetch_write lowercase 10m_physical ne_10m_geographic_lines # this should be build before derived Makefile themes run
./tools/wikidata/update.sh fetch_write lowercase 10m_physical ne_10m_geography_marine_polys # this should be build before derived Makefile themes run
./tools/wikidata/update.sh fetch_write lowercase 10m_physical ne_10m_geography_regions_elevation_points # this should be build before derived Makefile themes run
./tools/wikidata/update.sh fetch_write lowercase 10m_physical ne_10m_geography_regions_points # this should be build before derived Makefile themes run
./tools/wikidata/update.sh fetch_write lowercase 10m_physical ne_10m_geography_regions_polys # this should be build before derived Makefile themes run
./tools/wikidata/update.sh fetch_write lowercase 10m_physical ne_10m_lakes
./tools/wikidata/update.sh fetch_write lowercase 10m_physical ne_10m_lakes_europe
./tools/wikidata/update.sh fetch_write lowercase 10m_physical ne_10m_lakes_historic
./tools/wikidata/update.sh fetch_write lowercase 10m_physical ne_10m_lakes_north_america
./tools/wikidata/update.sh fetch_write lowercase 10m_physical ne_10m_playas
./tools/wikidata/update.sh fetch_write lowercase 10m_physical ne_10m_rivers_lake_centerlines
./tools/wikidata/update.sh fetch_write lowercase 10m_physical ne_10m_rivers_lake_centerlines_scale_rank
./tools/wikidata/update.sh fetch_write lowercase 10m_physical ne_10m_rivers_europe
./tools/wikidata/update.sh fetch_write lowercase 10m_physical ne_10m_rivers_north_america
}
function run50m {
# == 50m ================= |=========== |==========| ============| ================================================
./tools/wikidata/update.sh fetch_write uppercase 50m_cultural ne_50m_admin_0_sovereignty
./tools/wikidata/update.sh fetch_write uppercase 50m_cultural ne_50m_admin_0_countries
./tools/wikidata/update.sh fetch_write uppercase 50m_cultural ne_50m_admin_0_countries_lakes
./tools/wikidata/update.sh fetch_write uppercase 50m_cultural ne_50m_admin_0_map_units
./tools/wikidata/update.sh fetch_write uppercase 50m_cultural ne_50m_admin_0_map_subunits
./tools/wikidata/update.sh fetch_write uppercase 50m_cultural ne_50m_admin_0_tiny_countries # this should be build before derived Makefile themes run
./tools/wikidata/update.sh fetch_write uppercase 50m_cultural ne_50m_admin_0_breakaway_disputed_areas
./tools/wikidata/update.sh fetch_write lowercase 50m_cultural ne_50m_admin_1_states_provinces
./tools/wikidata/update.sh fetch_write lowercase 50m_cultural ne_50m_admin_1_states_provinces_lakes
./tools/wikidata/update.sh fetch_write lowercase 50m_physical ne_50m_lakes
./tools/wikidata/update.sh fetch_write lowercase 50m_physical ne_50m_lakes_historic
./tools/wikidata/update.sh fetch_write lowercase 50m_physical ne_50m_playas
./tools/wikidata/update.sh fetch_write lowercase 50m_physical ne_50m_rivers_lake_centerlines
./tools/wikidata/update.sh fetch_write lowercase 50m_physical ne_50m_rivers_lake_centerlines_scale_rank
}
function run110m {
# ==110m ================= |=========== |==========| ============| ================================================
./tools/wikidata/update.sh fetch_write uppercase 110m_cultural ne_110m_admin_0_sovereignty
./tools/wikidata/update.sh fetch_write uppercase 110m_cultural ne_110m_admin_0_countries
./tools/wikidata/update.sh fetch_write uppercase 110m_cultural ne_110m_admin_0_countries_lakes
./tools/wikidata/update.sh fetch_write uppercase 110m_cultural ne_110m_admin_0_map_units
./tools/wikidata/update.sh fetch_write lowercase 110m_cultural ne_110m_admin_1_states_provinces
./tools/wikidata/update.sh fetch_write lowercase 110m_cultural ne_110m_admin_1_states_provinces_lakes
./tools/wikidata/update.sh fetch_write lowercase 110m_physical ne_110m_lakes
./tools/wikidata/update.sh fetch_write lowercase 110m_physical ne_110m_rivers_lake_centerlines
}
# ======================== |=========== |==========| ============| ================================================
if [[ "$runmode" == "all" ]]
then
# =========================================================
# run all steps !
# =========================================================
run10m
run50m
run110m
# show summary
cat x_tempshape/update.md
# list new files
ls -Gga x_tempshape/*/*
# Update shape files ( if everything is OK! )
# Don't copy over the change logs, though (limit file extension expansion listing)
cp -r x_tempshape/10m_cultural/*.{shp,dbf,shx,prj,cpg} 10m_cultural/
cp -r x_tempshape/10m_physical/*.{shp,dbf,shx,prj,cpg} 10m_physical/
cp -r x_tempshape/50m_cultural/*.{shp,dbf,shx,prj,cpg} 50m_cultural/
cp -r x_tempshape/50m_physical/*.{shp,dbf,shx,prj,cpg} 50m_physical/
cp -r x_tempshape/110m_cultural/*.{shp,dbf,shx,prj,cpg} 110m_cultural/
cp -r x_tempshape/110m_physical/*.{shp,dbf,shx,prj,cpg} 110m_physical/
# test copy mode ( write again .. )
./tools/wikidata/update.sh copy uppercase 10m_cultural ne_10m_admin_0_countries
else
# =========================================================
# fast test !
# =========================================================
# travis osx hack - run a minimal test
run110m
# show summary
cat x_tempshape/update.md
# list new files
ls -Gga x_tempshape/*/*
# Update shape files ( if everything is OK! )
# Don't copy over the change logs, though (limit file extension expansion listing)
cp -r x_tempshape/110m_cultural/*.{shp,dbf,shx,prj,cpg} 110m_cultural/
cp -r x_tempshape/110m_physical/*.{shp,dbf,shx,prj,cpg} 110m_physical/
# test copy mode ( write again .. )
./tools/wikidata/update.sh copy lowercase 110m_physical ne_110m_rivers_lake_centerlines
fi
# Run the final update process
# (2018-05-20 nvkelso) NOTE: This works because the MapShaper build is manual
# if it were during all target we'd have a condition where the localized names would be
# reverted for some themes (mostly admin-0 and admin-1)
make clean all
echo " "
echo " ---------------------"
STOPDATE=$(date +"%Y-%m-%dT%H:%M%z")
echo "Stop: $STARTDATE "
echo " see log file: "
ls -Gga $log_file
echo " "
echo " ---- end of run_all.sh ------ "