From 07dc0b55a08b41327d5644daec8a7066cea14b54 Mon Sep 17 00:00:00 2001 From: marvin Date: Fri, 18 Sep 2026 00:32:02 +0200 Subject: [PATCH] =?UTF-8?q?Mask=20out=20Skytteh=C3=B8j=20and=20everything?= =?UTF-8?q?=20south=20of=20it=20(lat=2055.628)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add south_bound_lat to modes.yaml and a load_south_bound() helper in prepare.py. When set, the area geometry is intersected with the north half-plane above the cutoff, so all downstream clipping (lines, stops, stations) cascades automatically. Removed: 94 bus stops (including Skyttehøj), 1 station (Vestamager), and line segments south of the boundary (Metro M1 tail, buses 32-36). --- copenhagen/config/modes.yaml | 5 +++++ copenhagen/scripts/prepare.py | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/copenhagen/config/modes.yaml b/copenhagen/config/modes.yaml index 00151b8..b076eca 100644 --- a/copenhagen/config/modes.yaml +++ b/copenhagen/config/modes.yaml @@ -30,6 +30,11 @@ exclude: - agency: Snälltåget AB ref: "083" +# South bound: drop every stop/station south of this latitude (inclusive), +# and clip transit lines at this boundary. Used to cut the map short of +# Skyttehøj (Amager Landevej) and everything south of it on Amager. +south_bound_lat: 55.628 + modes: metro: agencies: [Metroselskabet] diff --git a/copenhagen/scripts/prepare.py b/copenhagen/scripts/prepare.py index ef03532..cf4d267 100644 --- a/copenhagen/scripts/prepare.py +++ b/copenhagen/scripts/prepare.py @@ -30,6 +30,7 @@ import sys import geopandas as gpd import pandas as pd import yaml +from shapely.geometry import box from _common import CONFIG, GTFS_RAW, PROCESSED @@ -69,6 +70,15 @@ def load_bus_whitelist(): } +def load_south_bound(): + """South latitude cutoff from modes.yaml, or None. + + When set, stops/stations south of (and transit lines below) this + latitude are dropped. Used to trim the map at a boundary. + """ + return _load_modes_yaml().get("south_bound_lat") + + def _load_modes_yaml(): return yaml.safe_load((CONFIG / "modes.yaml").read_text()) @@ -331,6 +341,12 @@ def main(): styling = load_styling() area_geom = load_area() + south_bound = load_south_bound() + if south_bound is not None: + north = box(-180, south_bound, 180, 90) + area_geom = area_geom.intersection(north) + print(f"south bound: clipping area at lat {south_bound}", flush=True) + routes = load_routes(modes, load_exclude()) bus_wl = load_bus_whitelist()