iduedu.get_intermodal_graph

iduedu.get_intermodal_graph(*, osm_id=None, territory=None, clip_by_territory=False, osm_edge_tags=None, max_dist=30, keep_largest_subgraph=True, add_link_edge=True, walk_kwargs=None, pt_kwargs=None)[source]

Build an intermodal (PT+walking) UrbanGraph for a territory.

The function resolves a boundary polygon (by osm_id or territory), runs pedestrian graph construction (get_walk_graph()) and public transport graph construction (get_public_transport_graph()) in parallel, then connects public-transport platforms to nearby walk edges via join_pt_walk_graph() using the max_dist snapping radius. Edge lengths (meters) and travel times (minutes) come from the underlying builders and from the walk-edge splits created during projection.

Parameters:
  • osm_id (int | None) – OSM relation/area id for the territory; provide this or territory.

  • territory (Polygon | MultiPolygon | gpd.GeoDataFrame | None) – Boundary geometry in EPSG:4326.

  • clip_by_territory (bool) – If True, both PT and Walk graphs are clipped to the boundary.

  • osm_edge_tags (list[str] | None) – Subset of OSM tags to retain (forwarded to both builders).

  • max_dist (float) – Max distance in meters to connect PT platforms to walk edges.

  • keep_largest_subgraph (bool) – If True, keep only the largest strongly connected component after joining.

  • add_link_edge (bool) – If True, add platform-to-walk connector edges during projection.

  • walk_kwargs (dict[str, Any] | None) – Extra keyword args for get_walk_graph() (e.g., walk_speed, simplify, osm_edge_tags, keep_largest_subgraph). Walk graph keep_largest_subgraph defaults to False unless explicitly set here.

  • pt_kwargs (dict[str, Any] | None) – Extra keyword args for get_public_transport_graph() (e.g., transport_types, osm_edge_tags, transport_registry).

Return type:

UrbanGraph

Returns:

Intermodal UrbanGraph combining public transport and pedestrian edges. The graph CRS equals the builders’ local projected CRS.

Notes

  • clip_by_territory and osm_edge_tags are propagated to both builders unless overridden in walk_kwargs/pt_kwargs.

  • If the PT graph is empty for the area, the function returns the walking graph alone (with a warning).

  • Joining requires both sub-graphs to share the same CRS; builders derive a local projected CRS from the boundary’s extent, so lengths/times are in meters/minutes.