Mask out Skyttehøj and everything south of it (lat 55.628)
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).
This commit is contained in:
@@ -30,6 +30,11 @@ exclude:
|
|||||||
- agency: Snälltåget AB
|
- agency: Snälltåget AB
|
||||||
ref: "083"
|
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:
|
modes:
|
||||||
metro:
|
metro:
|
||||||
agencies: [Metroselskabet]
|
agencies: [Metroselskabet]
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import sys
|
|||||||
import geopandas as gpd
|
import geopandas as gpd
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import yaml
|
import yaml
|
||||||
|
from shapely.geometry import box
|
||||||
|
|
||||||
from _common import CONFIG, GTFS_RAW, PROCESSED
|
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():
|
def _load_modes_yaml():
|
||||||
return yaml.safe_load((CONFIG / "modes.yaml").read_text())
|
return yaml.safe_load((CONFIG / "modes.yaml").read_text())
|
||||||
|
|
||||||
@@ -331,6 +341,12 @@ def main():
|
|||||||
styling = load_styling()
|
styling = load_styling()
|
||||||
area_geom = load_area()
|
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())
|
routes = load_routes(modes, load_exclude())
|
||||||
|
|
||||||
bus_wl = load_bus_whitelist()
|
bus_wl = load_bus_whitelist()
|
||||||
|
|||||||
Reference in New Issue
Block a user