Skip to content

Commit 295dfe4

Browse files
committed
Overture download script [#571]
* add bash help text * query for latest Overture release from STAC catalog
1 parent 9a0baa2 commit 295dfe4

1 file changed

Lines changed: 39 additions & 3 deletions

File tree

tiles/download-overture.sh

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,45 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
REL="${1:-2026-02-18.0}"
5-
BBOX="${2:-7.408446,43.722901,7.4405,43.752481}"
6-
OUT="data/sources/${3:-monaco.parquet}"
4+
STAC_CATALOG="https://stac.overturemaps.org/catalog.json"
5+
DEFAULT_BBOX="7.408446,43.722901,7.4405,43.752481"
6+
DEFAULT_OUT="data/sources/monaco.parquet"
7+
8+
usage() {
9+
cat <<EOF
10+
Usage: $0 [RELEASE] [BBOX] [OUTPUT]
11+
12+
Downloads Overture Maps data for a bounding box as a Parquet file.
13+
14+
Arguments:
15+
RELEASE Overture release version (default: latest, from ${STAC_CATALOG})
16+
BBOX xmin,ymin,xmax,ymax in WGS84 (default: ${DEFAULT_BBOX})
17+
OUTPUT Output file path (default: ${DEFAULT_OUT})
18+
19+
Example:
20+
$0 2026-06-17.0 -122.52,37.70,-122.35,37.83 data/sources/sf.parquet
21+
EOF
22+
}
23+
24+
latest_release() {
25+
# A network failure yields empty output rather than aborting under `set -e`,
26+
# so the caller can report it.
27+
duckdb -noheader -list -c \
28+
"SELECT latest FROM read_json('${STAC_CATALOG}')" 2>/dev/null || true
29+
}
30+
31+
if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then
32+
usage
33+
exit 0
34+
fi
35+
36+
REL="${1:-$(latest_release)}"
37+
if [[ -z "$REL" ]]; then
38+
echo "Could not determine the latest release from ${STAC_CATALOG}; pass one explicitly." >&2
39+
exit 1
40+
fi
41+
BBOX="${2:-$DEFAULT_BBOX}"
42+
OUT="${3:-$DEFAULT_OUT}"
743

844
IFS=',' read -r XMIN YMIN XMAX YMAX <<< "$BBOX"
945

0 commit comments

Comments
 (0)