2018-05-19 21:18:04 +02:00
#!/bin/bash
set -Eeuo pipefail
2018-05-19 20:36:55 +02:00
2018-05-20 11:44:57 +02:00
STARTDATE = $( date +"%Y-%m-%dT%H:%M%z" )
2018-05-20 21:55:54 +02:00
runmode = ${ 1 -all }
2018-05-20 11:44:57 +02:00
# 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!
2018-05-20 20:31:27 +02:00
echo "-----------------------------------"
2018-05-20 21:55:54 +02:00
echo " Runmode : $runmode "
2018-05-20 20:31:27 +02:00
echo " Version $( cat VERSION) "
echo " Start: $STARTDATE "
2018-05-20 11:44:57 +02:00
# Show some debug info
2018-05-19 20:36:55 +02:00
python3 ./tools/wikidata/platform_debug_info.py
2018-05-20 11:44:57 +02:00
2018-05-20 18:32:45 +02:00
# 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, ... ]
# --------------------------------------------------------------------------------------------------------------------
2018-05-20 20:31:27 +02:00
# | mode |LetterCase| shape_path | shape filename
# == 10m ================= |=========== |==========| ============| ================================================
2018-05-20 21:55:54 +02:00
function run10m {
2021-08-01 10:36:51 -07:00
./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
2018-05-20 22:01:24 -07:00
./tools/wikidata/update.sh fetch_write uppercase 10m_cultural ne_10m_admin_0_countries_lakes
2018-05-20 20:31:27 +02:00
./tools/wikidata/update.sh fetch_write uppercase 10m_cultural ne_10m_admin_0_map_units
2018-05-20 22:01:24 -07:00
./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
2021-08-01 10:36:51 -07:00
./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
2018-05-20 22:01:24 -07:00
./tools/wikidata/update.sh fetch_write lowercase 10m_cultural ne_10m_admin_1_states_provinces_lakes
2021-08-01 10:36:51 -07:00
./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
2018-05-20 20:31:27 +02:00
./tools/wikidata/update.sh fetch_write lowercase 10m_cultural ne_10m_airports
2018-05-20 22:01:24 -07:00
./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
2018-05-20 20:31:27 +02:00
./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
2018-05-20 22:01:24 -07:00
./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
2018-05-20 20:31:27 +02:00
./tools/wikidata/update.sh fetch_write lowercase 10m_physical ne_10m_rivers_north_america
2018-05-20 21:55:54 +02:00
}
function run50m {
2018-05-20 20:31:27 +02:00
# == 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
2018-05-20 22:01:24 -07:00
./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
2018-05-20 20:31:27 +02:00
./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
2018-05-20 21:55:54 +02:00
}
function run110m {
2018-05-20 20:31:27 +02:00
# ==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
2018-05-20 21:55:54 +02:00
}
2018-05-20 20:31:27 +02:00
# ======================== |=========== |==========| ============| ================================================
2018-05-20 11:44:57 +02:00
2018-05-20 21:55:54 +02:00
if [ [ " $runmode " = = "all" ] ]
then
# =========================================================
# run all steps !
2018-05-20 22:01:24 -07:00
# =========================================================
run10m
2018-05-20 21:55:54 +02:00
run50m
run110m
# show summary
cat x_tempshape/update.md
# list new files
ls -Gga x_tempshape/*/*
# Update shape files ( if everything is OK! )
2018-05-20 22:44:33 -07:00
# 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/
2018-05-20 21:55:54 +02:00
# test copy mode ( write again .. )
./tools/wikidata/update.sh copy uppercase 10m_cultural ne_10m_admin_0_countries
else
# =========================================================
# fast test !
2018-05-20 22:01:24 -07:00
# =========================================================
2018-05-20 21:55:54 +02:00
# 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! )
2018-05-20 22:44:33 -07:00
# 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/
2018-05-20 21:55:54 +02:00
# test copy mode ( write again .. )
./tools/wikidata/update.sh copy lowercase 110m_physical ne_110m_rivers_lake_centerlines
fi
2018-05-20 20:31:27 +02:00
2018-05-20 11:44:57 +02:00
# Run the final update process
2018-05-20 22:06:38 -07:00
# (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)
2018-05-19 21:18:04 +02:00
make clean all
2018-05-20 11:44:57 +02:00
2018-05-20 20:31:27 +02:00
echo " "
echo " ---------------------"
STOPDATE = $( date +"%Y-%m-%dT%H:%M%z" )
echo " Stop: $STARTDATE "
echo " see log file: "
ls -Gga $log_file
echo " "
2018-05-20 11:44:57 +02:00
echo " ---- end of run_all.sh ------ "
2018-05-20 20:31:27 +02:00