Add bus whitelist, route exclusions, crow-fly shape filter, and KML export #2

Open
marvin wants to merge 16 commits from add-kml-export-and-bus-filtering into master
2 changed files with 21 additions and 0 deletions
Showing only changes of commit 07dc0b55a0 - Show all commits
+5
View File
@@ -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]
+16
View File
@@ -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()