iduedu.get_walk_graph

iduedu.get_walk_graph(*, osm_id=None, territory=None, simplify=True, clip_by_territory=False, keep_largest_subgraph=True, walk_speed=83.33333333333333, network_type='walk', custom_filter=None, osm_edge_tags=None)[source]

Build a pedestrian UrbanGraph from OpenStreetMap within a given territory.

The function fetches OSM ways via Overpass using a walking filter, splits each way into line segments, and computes per-edge length (meters) and traversal time (minutes) using a given walking speed (m/min). The graph is stored as an undirected multigraph because pedestrian movement is treated as bidirectional.

Parameters:
  • osm_id (int | None) – OSM relation/area ID for the boundary. Provide this or territory.

  • territory (Polygon | MultiPolygon | gpd.GeoDataFrame | None) – Boundary geometry (EPSG:4326) or a GeoDataFrame to define the area when osm_id is not given.

  • simplify (bool) – If True, merges contiguous segments (via internal line merging) and transfers attributes back to merged lines using nearest midpoints; if False, keeps raw per-segment edges.

  • clip_by_territory (bool) – If True, clips edges by the provided boundary before graph construction.

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

  • walk_speed (float) – Walking speed in meters per minute used to compute time for each edge.

  • network_type (Literal['walk', 'custom']) – Preset of Overpass filters. Use custom mode with custom_filter to pass your own way filter.

  • custom_filter (str | None) – Custom Overpass filter string used in custom mode.

  • osm_edge_tags (list[str] | None) – List of OSM edge tags to retain (overrides defaults). Only these keys are joined from element tags.

Returns:

Undirected multigraph of the walking network. Edges include geometry in the local CRS, length, travel time and selected OSM tags. The graph keeps the local projected CRS and selected network type as metadata.

Return type:

UrbanGraph

Notes

All walking edges are treated as bidirectional by the undirected UrbanGraph adjacency builder. Lengths are measured in meters in a local projected CRS estimated from the territory bounds.