mirror of
https://github.com/thetechprepper/emcomm-tools-os-community.git
synced 2026-09-17 15:41:44 -04:00
Map - Fixed OSM map downloader with new logic to scrape new HTML format on Geofabrik site. This could be a moving target, but it is worth updating once more.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Author : Gaston Gonzalez
|
# Author : Gaston Gonzalez
|
||||||
# Date : 4 November 2024
|
# Date : 4 November 2024
|
||||||
|
# Updated : 3 December 2024
|
||||||
# Purpose : Downloads OSM .pbf file selected by user
|
# Purpose : Downloads OSM .pbf file selected by user
|
||||||
|
|
||||||
HTML=page.html
|
HTML=page.html
|
||||||
@@ -25,12 +26,11 @@ et-log "Extracting state-level .pbf file list..."
|
|||||||
|
|
||||||
options=()
|
options=()
|
||||||
while IFS= read -r state_html; do
|
while IFS= read -r state_html; do
|
||||||
state_file_suffix=$(echo $state_html | sed -n 's/.*href="\([^"]*\)".*/\1/p')
|
state_file=$(echo $state_html | sed -n 's|.*href="\([^"]*\.osm\.pbf\)".*|\1|p')
|
||||||
pbf_file=$(echo $state_file_suffix | sed 's|bz2|pbf|')
|
state_url="http://download.geofabrik.de/north-america/${state_file}"
|
||||||
state_url="http://download.geofabrik.de/north-america/${pbf_file}"
|
|
||||||
|
|
||||||
# Extract a display friendly name for the state
|
# Extract a display friendly name for the state
|
||||||
state_name=$(echo $state_file_suffix | sed 's|us/||' | sed 's|-latest.osm.bz2||')
|
state_name=$(echo $state_file | sed 's|us/||' | sed 's|-latest.osm.pbf||')
|
||||||
|
|
||||||
options+=("$state_name" "$state_url")
|
options+=("$state_name" "$state_url")
|
||||||
done < <(grep "[.]pbf" page.html | grep 'href="us/' | sort)
|
done < <(grep "[.]pbf" page.html | grep 'href="us/' | sort)
|
||||||
|
|||||||
Reference in New Issue
Block a user