#!/usr/bin/env python3 """Download the Rejseplanen GTFS feed for the Copenhagen area. STATUS: BLOCKED. Rejseplanen (journey planner) does not currently expose a public GTFS download. This script documents the intended flow and exits non-zero with guidance. When a feed URL becomes available, set it here and the script will download and unzip into data/raw/gtfs/. """ import sys import urllib.request import zipfile from pathlib import Path from _common import GTFS_RAW # Fill in once access is granted. Likely candidates: # - Rejseplanen / DOT open-data portal # - a static GTFS zip provided on request GTFS_URL = None # e.g. "https://.../rejseplanen.zip" def main(): if not GTFS_URL: print( "download_gtfs: BLOCKED — no GTFS feed URL configured.\n" "Set GTFS_URL in this script once Rejseplanen grants access, then re-run.\n" "The OSM-only pipeline (build_area -> download_osm -> prepare -> render)\n" "is fully functional without GTFS; GTFS only enriches colours/stops.", file=sys.stderr, ) sys.exit(2) GTFS_RAW.mkdir(parents=True, exist_ok=True) zip_path = GTFS_RAW / "feed.zip" print(f"downloading {GTFS_URL} -> {zip_path} ...", flush=True) urllib.request.urlretrieve(GTFS_URL, zip_path) with zipfile.ZipFile(zip_path) as z: z.extractall(GTFS_RAW) zip_path.unlink(missing_ok=True) print(f"extracted GTFS txt files into {GTFS_RAW}") if __name__ == "__main__": main()