@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
# Set defaults
|
# Set defaults
|
||||||
MEMORY="${MEMORY:-$(($(getconf _PHYS_PAGES) * $(getconf PAGE_SIZE) / 1024 / 1024 / 2))M}"
|
MEMORY="${MEMORY:-$(($(getconf _PHYS_PAGES) * $(getconf PAGE_SIZE) / 1024 / 1024 / 2))M}"
|
||||||
PLANET_PATHS=$'africa\nantarctica\nasia\naustralia-oceania\ncentral-america\neurope\nnorth-america\nrussia\nsouth-america'
|
|
||||||
|
|
||||||
# Fetch args
|
# Fetch args
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
@@ -143,7 +142,7 @@ single_planet() {
|
|||||||
|
|
||||||
osmium cat "./work/tmp/contours_new.osm" \
|
osmium cat "./work/tmp/contours_new.osm" \
|
||||||
-o "./work/tmp/contours.osm"
|
-o "./work/tmp/contours.osm"
|
||||||
done <<< "$PLANET_PATHS"
|
done <<< $(fetch_path "planet")
|
||||||
osmium export work/tmp/contours.osm \
|
osmium export work/tmp/contours.osm \
|
||||||
-o ./data/contours/planet.geojson \
|
-o ./data/contours/planet.geojson \
|
||||||
--overwrite
|
--overwrite
|
||||||
@@ -233,12 +232,17 @@ generate_region() {
|
|||||||
|
|
||||||
fetch_path() {
|
fetch_path() {
|
||||||
local PATH_ARG="$1"
|
local PATH_ARG="$1"
|
||||||
curl -s "https://download.geofabrik.de/$PATH_ARG/" |
|
curl -s https://download.geofabrik.de/index-v1-nogeom.json | jq -r --arg pid "$PATH_ARG" '
|
||||||
grep -oP 'href="\K[^"]+' |
|
.features[]
|
||||||
grep -vE '^\?C=|/icons/|Parent Directory|^/?$' |
|
| select(
|
||||||
sed 's|/$||' |
|
if ($pid == "" or $pid == "planet") then
|
||||||
grep ".poly" |
|
.properties.parent == null
|
||||||
sed 's/\.poly$//'
|
else
|
||||||
|
.properties.parent == $pid
|
||||||
|
end
|
||||||
|
)
|
||||||
|
| .properties.id
|
||||||
|
'
|
||||||
}
|
}
|
||||||
|
|
||||||
all_path() {
|
all_path() {
|
||||||
@@ -247,11 +251,10 @@ all_path() {
|
|||||||
|
|
||||||
if [ "$PATH_ARG" = "planet" ]; then
|
if [ "$PATH_ARG" = "planet" ]; then
|
||||||
PATH_ARG=""
|
PATH_ARG=""
|
||||||
SUBS=$PLANET_PATHS
|
|
||||||
else
|
|
||||||
SUBS=$(fetch_path "$PATH_ARG")
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
SUBS=$(fetch_path "$PATH_ARG")
|
||||||
|
|
||||||
if [[ -z "$SUBS" ]]; then
|
if [[ -z "$SUBS" ]]; then
|
||||||
while IFS= read -r REG; do
|
while IFS= read -r REG; do
|
||||||
generate_region "$PATH_ARG" "$MEMORY"
|
generate_region "$PATH_ARG" "$MEMORY"
|
||||||
|
|||||||
Reference in New Issue
Block a user