Add orphan bus stops (platforms not in route relations)

Some bus stop platform nodes in OSM are not members of any route
relation (e.g. Borgergade). These were missed by the route-membership
download approach. Now download_osm.py:
- tracks bus platform node ids captured by route queries
- runs a supplementary query for all highway=bus_stop + platform nodes
- appends orphans (with empty route_refs) to the bus stops layer

render.py: orphan stops (empty route_refs) fall back to distance
clustering instead of route-membership grouping.

Results: 1164 route-member stops + 707 orphans = 1871 total
-> 1370 after clip -> 1049 markers after grouping
This commit is contained in:
2026-09-14 00:22:15 +02:00
parent 54708e6cb3
commit 4aca62ca1a
2 changed files with 70 additions and 2 deletions
+6 -2
View File
@@ -311,12 +311,16 @@ def group_by_route_membership(rows, cluster_m):
centroids = []
for indices in components.values():
comp_coords = [coords[i] for i in indices]
comp_routes = [route_sets[i] for i in indices]
has_routes = any(rs for rs in comp_routes)
if len(comp_coords) == 1:
centroids.append(comp_coords[0])
else:
elif has_routes:
# stops sharing a route are the same stop; merge to centroid
import numpy as np
centroids.append(tuple(np.mean(comp_coords, axis=0)))
else:
# no route info (orphans); fall back to distance clustering
centroids.extend(cluster_stops(comp_coords, cluster_m))
return centroids