Compare commits
11
Commits
38d11cd0b0
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ff9f4e293 | ||
|
|
d218ac85d3 | ||
|
|
75464e896c | ||
|
|
ef97b26f07 | ||
|
|
10b4bf51d9 | ||
|
|
b758c1a17c | ||
|
|
a04e3b2b32 | ||
|
|
32047a3d47 | ||
|
|
6a6fad2e77 | ||
|
|
bd950a1650 | ||
|
|
57210ba0b2 |
@@ -4,6 +4,8 @@
|
|||||||
MEMORY="${MEMORY:-$(($(getconf _PHYS_PAGES) * $(getconf PAGE_SIZE) / 1024 / 1024 / 2))M}"
|
MEMORY="${MEMORY:-$(($(getconf _PHYS_PAGES) * $(getconf PAGE_SIZE) / 1024 / 1024 / 2))M}"
|
||||||
|
|
||||||
# Fetch args
|
# Fetch args
|
||||||
|
PATH_ARG=""
|
||||||
|
MODE=""
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-m|--memory)
|
-m|--memory)
|
||||||
@@ -105,6 +107,11 @@ fi
|
|||||||
echo "Processing path '$PATH_ARG' in $MODE mode with $MEMORY memory allocated..."
|
echo "Processing path '$PATH_ARG' in $MODE mode with $MEMORY memory allocated..."
|
||||||
|
|
||||||
# Define functions
|
# Define functions
|
||||||
|
system_path() {
|
||||||
|
local input="$1"
|
||||||
|
echo "${input//\/\//\/}"
|
||||||
|
}
|
||||||
|
|
||||||
should_skip() {
|
should_skip() {
|
||||||
local path="$1"
|
local path="$1"
|
||||||
|
|
||||||
@@ -127,7 +134,7 @@ single_planet() {
|
|||||||
wget "https://planet.openstreetmap.org/pbf/planet-latest.osm.pbf" -O "./data/osm/planet.osm.pbf"
|
wget "https://planet.openstreetmap.org/pbf/planet-latest.osm.pbf" -O "./data/osm/planet.osm.pbf"
|
||||||
|
|
||||||
while IFS= read -r REG; do
|
while IFS= read -r REG; do
|
||||||
mkdir -p "./work/poly/europe"
|
mkdir -p "./work/poly"
|
||||||
wget "https://download.geofabrik.de/$REG.poly" -O "./work/poly/$REG.poly"
|
wget "https://download.geofabrik.de/$REG.poly" -O "./work/poly/$REG.poly"
|
||||||
|
|
||||||
mkdir -p "./work/contours/$REG"
|
mkdir -p "./work/contours/$REG"
|
||||||
@@ -141,7 +148,7 @@ single_planet() {
|
|||||||
--max-nodes-per-tile=0 \
|
--max-nodes-per-tile=0 \
|
||||||
--output-prefix="./work/contours/$REG/con"
|
--output-prefix="./work/contours/$REG/con"
|
||||||
|
|
||||||
mv "./work/contours/$REG"/con* "./data/countours/osm/$REG.osm"
|
mv "./work/contours/$REG"/con* "./data/contours/osm/$REG.osm"
|
||||||
|
|
||||||
osmium export ./data/contours/osm/$REG.osm \
|
osmium export ./data/contours/osm/$REG.osm \
|
||||||
-o ./data/contours/geojson/$REG.geojson \
|
-o ./data/contours/geojson/$REG.geojson \
|
||||||
@@ -165,64 +172,61 @@ generate_region() {
|
|||||||
local PATH_ARG="$1"
|
local PATH_ARG="$1"
|
||||||
local MEMORY="$2"
|
local MEMORY="$2"
|
||||||
|
|
||||||
PATH_ARG="${PATH_ARG%/}"
|
PATH_ARG="${PATH_ARG%//}"
|
||||||
|
|
||||||
if should_skip "$PATH_ARG"; then
|
if should_skip "$(system_path "${PATH_ARG}")"; then
|
||||||
echo "Skipping excluded region: $PATH_ARG"
|
echo "Skipping excluded region: $(system_path "${PATH_ARG}")"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Generating region: $PATH_ARG"
|
echo "Generating region: $(system_path "${PATH_ARG}")"
|
||||||
|
|
||||||
if [[ "$TEST" == "1" ]]; then
|
if [[ "$TEST" == "1" ]]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "./work/poly/${PATH_ARG%/*}"
|
mkdir -p "./work/poly/$(system_path "${PATH_ARG%//*}")"
|
||||||
wget "https://download.geofabrik.de/$PATH_ARG.poly" -O "./work/poly/$PATH_ARG.poly"
|
wget "https://download.geofabrik.de/$(system_path "${PATH_ARG}").poly" -O "./work/poly/$(system_path "${PATH_ARG}").poly"
|
||||||
|
|
||||||
mkdir -p "./work/contours/${PATH_ARG}"
|
mkdir -p "./work/contours/$(system_path "${PATH_ARG}")"
|
||||||
pyhgtmap \
|
pyhgtmap \
|
||||||
--polygon="./work/poly/$PATH_ARG.poly" \
|
--polygon="./work/poly/$(system_path "${PATH_ARG}").poly" \
|
||||||
--step=100 \
|
--step=100 \
|
||||||
--hgtdir=work/hgt \
|
--hgtdir=work/hgt \
|
||||||
--sources=view1,view3 \
|
--sources=view1,view3 \
|
||||||
--simplifyContoursEpsilon=0.001 \
|
--simplifyContoursEpsilon=0.001 \
|
||||||
-j16 \
|
-j16 \
|
||||||
--max-nodes-per-tile=0 \
|
--max-nodes-per-tile=0 \
|
||||||
--output-prefix="./work/contours/$PATH_ARG/con"
|
--output-prefix="./work/contours/$(system_path "${PATH_ARG}")/con"
|
||||||
|
|
||||||
mkdir -p "./data/contours/osm/${PATH_ARG%/*}"
|
mkdir -p "./data/contours/osm/$(system_path "${PATH_ARG%//*}")"
|
||||||
# max-nodes-per-tile=0 SHOULD generate only one file
|
# max-nodes-per-tile=0 SHOULD generate only one file
|
||||||
# still very much wonky though
|
# still very much wonky though
|
||||||
mv "./work/contours/$PATH_ARG"/con* "./data/contours/osm/$PATH_ARG.osm"
|
mv "./work/contours/$(system_path "${PATH_ARG}")"/con* "./data/contours/osm/$(system_path "${PATH_ARG}").osm"
|
||||||
|
|
||||||
mkdir -p "./data/contours/geojson/${PATH_ARG%/*}"
|
mkdir -p "./data/contours/geojson/$(system_path "${PATH_ARG%//*}")"
|
||||||
osmium export ./data/contours/osm/${PATH_ARG}.osm \
|
osmium export ./data/contours/osm/$(system_path "${PATH_ARG}").osm \
|
||||||
-o ./data/contours/geojson/${PATH_ARG}.geojson \
|
-o ./data/contours/geojson/$(system_path "${PATH_ARG}").geojson \
|
||||||
--overwrite
|
--overwrite
|
||||||
|
|
||||||
mkdir -p "./out/${PATH_ARG%/*}"
|
mkdir -p "./out/$(system_path "${PATH_ARG%//*}")"
|
||||||
|
|
||||||
mkdir -p "./data/osm/${PATH_ARG%/*}"
|
mkdir -p "./data/osm/$(system_path "${PATH_ARG%//*}")"
|
||||||
wget "https://download.geofabrik.de/${PATH_ARG%/*}/$(
|
wget "$(
|
||||||
curl -s "https://download.geofabrik.de/${PATH_ARG%/*}/" |
|
curl -s https://download.geofabrik.de/index-v1-nogeom.json |
|
||||||
grep -oP 'href="\K[^"]+' |
|
jq -r --arg pid "${PATH_ARG##*//}" --arg parent "$(awk -F/ '{print $(NF-1)}' <<< "$(system_path "${PATH_ARG}")")" '
|
||||||
grep -vE '^\?C=|/icons/|Parent Directory|^/?$' |
|
.. | objects
|
||||||
sed 's|/$||' |
|
| select(.id? == $pid and .parent? == $parent)
|
||||||
grep '\.osm\.pbf$' |
|
| .urls.pbf
|
||||||
grep -v '\.md5$' |
|
'
|
||||||
grep "${PATH_ARG##*/}" |
|
)" -O "./data/osm/$(system_path "${PATH_ARG}").osm.pbf"
|
||||||
sort |
|
|
||||||
tail -n 1
|
|
||||||
)" -O "./data/osm/${PATH_ARG}.osm.pbf"
|
|
||||||
|
|
||||||
java -Xmx"$MEMORY" \
|
java -Xmx"$MEMORY" \
|
||||||
-jar ./bin/planetiler.jar schema.yml \
|
-jar ./bin/planetiler.jar schema.yml \
|
||||||
--download \
|
--download \
|
||||||
--osm_file="./data/osm/${PATH_ARG}.osm.pbf" \
|
--osm_file="./data/osm/$(system_path "${PATH_ARG}").osm.pbf" \
|
||||||
--contour_file="./data/contours/geojson/${PATH_ARG}.geojson" \
|
--contour_file="./data/contours/geojson/$(system_path "${PATH_ARG}").geojson" \
|
||||||
--output="./out/${PATH_ARG}.mbtiles" \
|
--output="./out/$(system_path "${PATH_ARG}").mbtiles" \
|
||||||
--no-simplify \
|
--no-simplify \
|
||||||
--simplify-tolerance-at-max-zoom=0 \
|
--simplify-tolerance-at-max-zoom=0 \
|
||||||
--no-feature-merge \
|
--no-feature-merge \
|
||||||
@@ -231,7 +235,7 @@ generate_region() {
|
|||||||
|
|
||||||
fetch_path() {
|
fetch_path() {
|
||||||
local PATH_ARG="$1"
|
local PATH_ARG="$1"
|
||||||
curl -s https://download.geofabrik.de/index-v1-nogeom.json | jq -r --arg pid "$PATH_ARG" '
|
curl -s https://download.geofabrik.de/index-v1-nogeom.json | jq -r --arg pid "${PATH_ARG##*//}" '
|
||||||
.features[]
|
.features[]
|
||||||
| select(
|
| select(
|
||||||
if ($pid == "" or $pid == "planet") then
|
if ($pid == "" or $pid == "planet") then
|
||||||
@@ -263,7 +267,7 @@ all_path() {
|
|||||||
else
|
else
|
||||||
while IFS= read -r REG; do
|
while IFS= read -r REG; do
|
||||||
if [[ -n "$PATH_ARG" ]]; then
|
if [[ -n "$PATH_ARG" ]]; then
|
||||||
all_path "$PATH_ARG/$REG" "$((DEPTH + 1))"
|
all_path "$PATH_ARG//$REG" "$((DEPTH + 1))"
|
||||||
else
|
else
|
||||||
all_path "$REG" "$((DEPTH + 1))"
|
all_path "$REG" "$((DEPTH + 1))"
|
||||||
fi
|
fi
|
||||||
@@ -294,8 +298,8 @@ if [ "$MODE" == "single" ]; then
|
|||||||
single_planet
|
single_planet
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
generate_region "$PATH_ARG" "$MEMORY"
|
generate_region "${PATH_ARG//\//\/\/}" "$MEMORY"
|
||||||
exit 0
|
exit 0
|
||||||
elif [[ "$MODE" == "recursive" ]]; then
|
elif [[ "$MODE" == "recursive" ]]; then
|
||||||
all_path "$PATH_ARG"
|
all_path "${PATH_ARG//\//\/\/}"
|
||||||
fi
|
fi
|
||||||
+11
-6
@@ -125,7 +125,7 @@ layers:
|
|||||||
geometry: polygon
|
geometry: polygon
|
||||||
include_when:
|
include_when:
|
||||||
building: __any__
|
building: __any__
|
||||||
man_made: [bridge, wasterwater_plant, water_works, works, breakwater, pier]
|
man_made: [bridge, wastewater_plant, water_works, works, breakwater, pier]
|
||||||
attributes:
|
attributes:
|
||||||
- key: class
|
- key: class
|
||||||
type: match_value
|
type: match_value
|
||||||
@@ -193,14 +193,14 @@ layers:
|
|||||||
- source: osm
|
- source: osm
|
||||||
geometry: polygon
|
geometry: polygon
|
||||||
include_when:
|
include_when:
|
||||||
landuse: [commercial, construction, education, fairground, industrial, residential, retail, institutional, aquaculture, alloments, farmland, farmyard, animal_keeping, flowerbed, forest, logging, greenhouse_horticulture, meadow, orchard, plant_nursery, vineyard, depot, garages, highway, port, railway, basin, salt_pond, bronwfield, cemetery, grass, greenfield, landfill, military, quarry, recreation_ground, religious, village_green, greenery, winter_sports]
|
landuse: [commercial, construction, education, fairground, industrial, residential, retail, institutional, aquaculture, allotments, farmland, farmyard, animal_keeping, flowerbed, forest, logging, greenhouse_horticulture, meadow, orchard, plant_nursery, vineyard, depot, garages, highway, port, railway, basin, salt_pond, brownfield, cemetery, grass, greenfield, landfill, military, quarry, recreation_ground, religious, village_green, greenery, winter_sports]
|
||||||
amenity: [college, dancing_school, driving_school, first_aid_school, kindergarten, language_school, library, surf_school, toy_library, research_insitute, training, music_school, school, traffic_park, university, parking, parking_space, clinic, dentist, doctors, hospital, nursing_home, pharmacy, social_facility, veterinary, gambling, courthouse, fire_station, police, prison, townhall, crematorium, dive_centre, funeral_hall, grave_yard, marketplace, monastery, mortuary]
|
amenity: [college, dancing_school, driving_school, first_aid_school, kindergarten, language_school, library, surf_school, toy_library, research_institute, training, music_school, school, traffic_park, university, parking, parking_space, clinic, dentist, doctors, hospital, nursing_home, pharmacy, social_facility, veterinary, gambling, courthouse, fire_station, police, prison, townhall, crematorium, dive_centre, funeral_hall, grave_yard, marketplace, monastery, mortuary]
|
||||||
waterway: [boatyard]
|
waterway: [boatyard]
|
||||||
military: [danger_area]
|
military: [danger_area]
|
||||||
landcover: __any__
|
landcover: __any__
|
||||||
leisure: [garden, park, pitch, dog_park, fishing, marina, nature_reserve, playground, stadium, track, playground, sports_centre]
|
leisure: [garden, park, pitch, dog_park, fishing, marina, nature_reserve, playground, stadium, track, playground, sports_centre]
|
||||||
natural: [fell, grassland, heath, scrub, wood, tundra, bay, beach, blowhole, crevasse, shingle, shoal, bare_rock, hill, sand, scree, tree]
|
natural: [fell, grassland, heath, scrub, wood, tundra, bay, beach, blowhole, crevasse, shingle, shoal, bare_rock, hill, sand, scree, tree]
|
||||||
highway: [service, pedestrian]
|
highway: [rest_area, service, pedestrian]
|
||||||
attributes:
|
attributes:
|
||||||
- key: class
|
- key: class
|
||||||
type: match_key
|
type: match_key
|
||||||
@@ -218,13 +218,17 @@ layers:
|
|||||||
geometry: line
|
geometry: line
|
||||||
include_when:
|
include_when:
|
||||||
route: __any__
|
route: __any__
|
||||||
highway: [motorway, trunk, primary, secondary, tertiary, unclassified,residential, motorway_link, trunk_link, primary_link, secondary_link, tertiary_link, living_street, service, pedestrian, track, bus_guideway, escape, raceway, road, busway, footway, bridleway, steps, corridor, path, via_ferrata, cicleway, ladder, platform]
|
highway: [motorway, trunk, primary, secondary, tertiary, unclassified,residential, motorway_link, trunk_link, primary_link, secondary_link, tertiary_link, living_street, service, pedestrian, track, bus_guideway, escape, raceway, road, busway, footway, bridleway, steps, corridor, path, via_ferrata, cycleway, ladder, platform]
|
||||||
aerialway: [gondola, mixed_lift, chair_lift, drag_lift, t-bar, j-bar, platter, rope_tow, magic_carpet, zip_line, goods]
|
aerialway: [gondola, mixed_lift, chair_lift, drag_lift, t-bar, j-bar, platter, rope_tow, magic_carpet, zip_line, goods]
|
||||||
footway: [sidewalk, crossing, traffic_island]
|
footway: [sidewalk, crossing, traffic_island]
|
||||||
cycleway: [lane, track, share_busway, shared_lane]
|
cycleway: [lane, track, share_busway, shared_lane]
|
||||||
aeroway: [runway, stopway, taxiway]
|
aeroway: [runway, stopway, taxiway]
|
||||||
railway: [abandoned, construction, disused, funicular, light_rail, miniature, monorail, narrow_gauge, rail, subway, tram]
|
railway: [abandoned, construction, disused, funicular, light_rail, miniature, monorail, narrow_gauge, rail, subway, tram]
|
||||||
man_made: [goods_conveyor]
|
man_made: [goods_conveyor]
|
||||||
|
- source: osm
|
||||||
|
geometry: point
|
||||||
|
include_when:
|
||||||
|
highway: [motorway_junction, passing_place, mini_roundabout, speed_camera, speed_display, toll_ganty, turning_circle, turning_loop]
|
||||||
attributes:
|
attributes:
|
||||||
- key: class
|
- key: class
|
||||||
type: match_key
|
type: match_key
|
||||||
@@ -362,6 +366,7 @@ layers:
|
|||||||
- source: osm
|
- source: osm
|
||||||
geometry: line
|
geometry: line
|
||||||
include_when:
|
include_when:
|
||||||
attracion: [slide, water_slide, lazy_river]
|
attraction: [slide, water_slide, lazy_river]
|
||||||
man_made: [pipeline]
|
man_made: [pipeline]
|
||||||
leisure: [track]
|
leisure: [track]
|
||||||
|
highway: [platform]
|
||||||
|
|||||||
Reference in New Issue
Block a user