Implement each region generation
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
/work/
|
||||
/venv/
|
||||
/tmp/
|
||||
/out/
|
||||
/data/
|
||||
/bin/
|
||||
@@ -5,10 +5,71 @@ if [ "$#" -ne 3 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
REGION_ROOT="$1"
|
||||
REGION="$2"
|
||||
MEMORY="$3"
|
||||
#Define functions
|
||||
generate_region() {
|
||||
local REGION="$1"
|
||||
local REGION_ROOT="$2"
|
||||
local MEMORY="${3:-8g}"
|
||||
|
||||
local POLY_FILE="${REGION}.poly"
|
||||
|
||||
mkdir -p work
|
||||
wget -O "work/$POLY_FILE" \
|
||||
"https://download.geofabrik.de/${REGION_ROOT}/${REGION}.poly"
|
||||
|
||||
mkdir -p "work/contours/$REGION_ROOT/$REGION"
|
||||
|
||||
pyhgtmap \
|
||||
--polygon="work/$POLY_FILE" \
|
||||
--step=75 \
|
||||
--hgtdir=work/hgt \
|
||||
--sources=view1,view3 \
|
||||
--simplifyContoursEpsilon=0.001 \
|
||||
-j16 \
|
||||
--max-nodes-per-tile=0 \
|
||||
--output-prefix="work/contours/$REGION_ROOT/$REGION/con"
|
||||
|
||||
rm -f work/contours.osm
|
||||
|
||||
# max-nodes-per-tile=0 SHOULD generate only one file
|
||||
mv "work/contours/$REGION_ROOT/$REGION"/con* work/contours.osm
|
||||
|
||||
rm -rf "work/contours/$REGION_ROOT/"
|
||||
|
||||
rm -f data/contours.geojson
|
||||
|
||||
osmium export work/contours.osm \
|
||||
-o data/contours.geojson \
|
||||
--overwrite
|
||||
|
||||
rm -f work/contours.osm
|
||||
|
||||
mkdir -p "./out/$REGION_ROOT"
|
||||
|
||||
java -Xmx"$MEMORY" \
|
||||
-jar ./bin/planetiler.jar schema.yml \
|
||||
--download \
|
||||
--area="${REGION}" \
|
||||
--output="./out/${REGION_ROOT}/${REGION}.mbtiles" \
|
||||
--no-simplify \
|
||||
--simplify-tolerance-at-max-zoom=0 \
|
||||
--no-feature-merge \
|
||||
--simplify-tolerance=0
|
||||
}
|
||||
|
||||
generate_root() {
|
||||
local REGION_ROOT="$1"
|
||||
local REGION="$2"
|
||||
if [[ "$REGION" == "each" ]]; then
|
||||
while IFS= read -r REGION; do
|
||||
generate_region "$REGION" "$REGION_ROOT" "$MEMORY"
|
||||
done < "defs/regions/roots/${REGION_ROOT}.txt"
|
||||
else
|
||||
generate_region "$REGION" "$REGION_ROOT" "$MEMORY"
|
||||
fi
|
||||
}
|
||||
|
||||
#Prepare environment
|
||||
if [ ! -f ./bin/planetiler.jar ]; then
|
||||
mkdir -p ./bin
|
||||
wget -O ./bin/planetiler.jar https://github.com/onthegomap/planetiler/releases/latest/download/planetiler.jar
|
||||
@@ -20,26 +81,21 @@ if [ ! -d "$VENV_DIR" ]; then
|
||||
. "$VENV_DIR/bin/activate"
|
||||
pip install --upgrade pip
|
||||
pip install pyhgtmap
|
||||
source "$VENV_DIR/bin/activate"
|
||||
else
|
||||
source "$VENV_DIR/bin/activate"
|
||||
fi
|
||||
|
||||
POLY_FILE="${REGION}.poly"
|
||||
mkdir -p work
|
||||
wget -O "work/$POLY_FILE" "https://download.geofabrik.de/${REGION_ROOT}${REGION}.poly"
|
||||
REGION_ROOT="$1"
|
||||
REGION="$2"
|
||||
MEMORY="$3"
|
||||
|
||||
rm -f data/contours.osm
|
||||
pyhgtmap --polygon="work/$POLY_FILE" --step=75 --hgtdir=work/hgt --sources=view1,view3 --simplifyContoursEpsilon=0.001 -j16 --max-nodes-per-tile=0 --output-prefix data/contours
|
||||
|
||||
osmium export data/contours.osm -o data/contours.geojson --overwrite
|
||||
rm -f data/contours.osm
|
||||
|
||||
mkdir -p ./out
|
||||
java -Xmx"$MEMORY" -jar ./bin/planetiler.jar schema.yml \
|
||||
--download \
|
||||
--area=${REGION} \
|
||||
--output="./out/${REGION}.mbtiles" \
|
||||
--no-simplify \
|
||||
--simplify-tolerance-at-max-zoom=0 \
|
||||
--no-feature-merge \
|
||||
--simplify-tolerance=0
|
||||
#Generate
|
||||
if [[ "$REGION_ROOT" == "each" ]]; then
|
||||
while IFS= read -r REGION_ROOT; do
|
||||
# Straight up just ignore REGION here
|
||||
generate_root "$REGION_ROOT" "each" "$MEMORY"
|
||||
done < "defs/regions/planet.txt"
|
||||
else
|
||||
generate_root "$REGION_ROOT" "$REGION" "$MEMORY"
|
||||
fi
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
Local definitions
|
||||
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
africa
|
||||
antarctica
|
||||
asia
|
||||
australia-oceania
|
||||
central-america
|
||||
europe
|
||||
north-america
|
||||
south-america
|
||||
@@ -0,0 +1,55 @@
|
||||
algeria
|
||||
angola
|
||||
benin
|
||||
botswana
|
||||
burkina-faso
|
||||
burundi
|
||||
cameroon
|
||||
canary-islands
|
||||
cape-verde
|
||||
central-african-republic
|
||||
chad
|
||||
comores
|
||||
congo-brazzaville
|
||||
congo-democratic-republic
|
||||
djibouti
|
||||
egypt
|
||||
equatorial-guinea
|
||||
eritrea
|
||||
ethiopia
|
||||
gabon
|
||||
ghana
|
||||
guinea
|
||||
guinea-bissau
|
||||
ivory-coast
|
||||
kenya
|
||||
lesotho
|
||||
liberia
|
||||
libya
|
||||
madagascar
|
||||
malawi
|
||||
mali
|
||||
mauritania
|
||||
mauritius
|
||||
morocco
|
||||
mozambique
|
||||
namibia
|
||||
niger
|
||||
nigeria
|
||||
rwanda
|
||||
saint-helena-ascension-and-tristan-da-cunha
|
||||
sao-tome-and-principe
|
||||
senegal-and-gambia
|
||||
seychelles
|
||||
sierra-leone
|
||||
somalia
|
||||
south-africa
|
||||
south-sudan
|
||||
sudan
|
||||
swaziland
|
||||
tanzania
|
||||
togo
|
||||
tunisia
|
||||
uganda
|
||||
zambia
|
||||
zimbabwe
|
||||
@@ -0,0 +1,38 @@
|
||||
afghanistan
|
||||
armenia
|
||||
azerbaijan
|
||||
bangladesh
|
||||
bhutan
|
||||
cambodia
|
||||
china
|
||||
east-timor
|
||||
gcc-states
|
||||
india
|
||||
indonesia
|
||||
iran
|
||||
iraq
|
||||
israel-and-palestine
|
||||
japan
|
||||
jordan
|
||||
kazakhstan
|
||||
kyrgyzstan
|
||||
laos
|
||||
lebanon
|
||||
malaysia-singapore-brunei
|
||||
maldives
|
||||
mongolia
|
||||
myanmar
|
||||
nepal
|
||||
north-korea
|
||||
pakistan
|
||||
philippines
|
||||
south-korea
|
||||
sri-lanka
|
||||
syria
|
||||
taiwan
|
||||
tajikistan
|
||||
thailand
|
||||
turkmenistan
|
||||
uzbekistan
|
||||
vietnam
|
||||
yemen
|
||||
@@ -0,0 +1,23 @@
|
||||
american-oceania
|
||||
australia
|
||||
cook-islands
|
||||
fiji
|
||||
ile-de-clipperton
|
||||
kiribati
|
||||
marshall-islands
|
||||
micronesia
|
||||
nauru
|
||||
new-caledonia
|
||||
new-zealand
|
||||
niue
|
||||
palau
|
||||
papua-new-guinea
|
||||
pitcairn-islands
|
||||
polynesie-francaise
|
||||
samoa
|
||||
solomon-islands
|
||||
tokelau
|
||||
tonga
|
||||
tuvalu
|
||||
vanuatu
|
||||
wallis-et-futuna
|
||||
@@ -0,0 +1,11 @@
|
||||
bahamas
|
||||
belize
|
||||
costa-rica
|
||||
cuba
|
||||
el-salvador
|
||||
guatemala
|
||||
haiti-and-domrep
|
||||
honduras
|
||||
jamaica
|
||||
nicaragua
|
||||
panama
|
||||
@@ -0,0 +1,53 @@
|
||||
albania
|
||||
alps
|
||||
andorra
|
||||
austria
|
||||
azores
|
||||
belarus
|
||||
belgium
|
||||
bosnia-herzegovina
|
||||
britain-and-ireland
|
||||
bulgaria
|
||||
croatia
|
||||
cyprus
|
||||
czech-republic
|
||||
dach
|
||||
denmark
|
||||
estonia
|
||||
faroe-islands
|
||||
finland
|
||||
france
|
||||
georgia
|
||||
germany
|
||||
great-britain
|
||||
greece
|
||||
guernsey-jersey
|
||||
hungary
|
||||
iceland
|
||||
ireland-and-northern-ireland
|
||||
isle-of-man
|
||||
italy
|
||||
kosovo
|
||||
latvia
|
||||
liechtenstein
|
||||
lithuania
|
||||
luxembourg
|
||||
macedonia
|
||||
malta
|
||||
moldova
|
||||
monaco
|
||||
montenegro
|
||||
netherlands
|
||||
norway
|
||||
poland
|
||||
portugal
|
||||
romania
|
||||
serbia
|
||||
slovakia
|
||||
slovenia
|
||||
spain
|
||||
sweden
|
||||
switzerland
|
||||
turkey
|
||||
ukraine
|
||||
united-kingdom
|
||||
@@ -0,0 +1,9 @@
|
||||
canada
|
||||
greenland
|
||||
mexico
|
||||
us
|
||||
us-midwest
|
||||
us-northeast
|
||||
us-pacific
|
||||
us-south
|
||||
us-west
|
||||
@@ -0,0 +1,12 @@
|
||||
argentina
|
||||
bolivia
|
||||
brazil
|
||||
chile
|
||||
colombia
|
||||
ecuador
|
||||
guyana
|
||||
paraguay
|
||||
peru
|
||||
suriname
|
||||
uruguay
|
||||
venezuela
|
||||
@@ -344,4 +344,3 @@ layers:
|
||||
attracion: [slide, water_slide, lazy_river]
|
||||
man_made: [pipeline]
|
||||
leisure: [track]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user