#!/usr/bin/env python3 """Export the master GeoPackage to a Google My Maps-importable KML. Reads (from data/processed): master.gpkg (lines, stops, stations), area.gpkg Read (from config): coastline.kml — the coastline layer extracted verbatim from the reference map (https://www.google.com/maps/d/u/0/kml?mid=17T6ZDYbGz72h_eteL-CxdkiaXcgDLEA&forcekml=1) Writes: output/copenhagen-mymaps.kml My Maps turns each top-level KML Folder into a layer on import. We emit: Bus stops / Bus routes Train stations / Train routes (metro + S-tog + light rail + regional) Ferry stops / Ferry routes City Pass boundary (outline + faint fill) Coastline (verbatim from the reference map's layer) Colours match the PNG map: routes use colour_final from prepare.py; stop icons use styling.yaml palette defaults (train stations match the reference map's red pin). Import manually in Google My Maps: Create map → Import → upload the .kml. """ import re import sys import xml.etree.ElementTree as ET import geopandas as gpd import yaml from _common import CONFIG, OUTPUT, PROCESSED KML = "http://www.opengis.net/kml/2.2" ET.register_namespace("", KML) # My Maps stock pin (same as the reference map uses); tinted via IconStyle. ICON_HREF = "https://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png" ICON_SCALE = 1.0 TRAIN_STATION_COLOR = "#C2185B" # reference map's station-pin red TRAIN_STYLES = ["metro", "s_tog", "light_rail", "regional"] # route line widths in pixels, per style LINE_WIDTH = { "metro": 4.5, "s_tog": 4.25, "light_rail": 4.25, "regional": 3.5, "ferry": 3.75, "bus": 2.75, } BOUNDARY_COLOR = "#006064" BOUNDARY_LINE_WIDTH = 3.0 BOUNDARY_FILL_ALPHA = 0x54 # ~33 % class Styles: """Registry of unique (kind, color, width) -> KML