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 (or a local OSM file in pbf mode) 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 orterritory.territory (
Polygon | MultiPolygon | gpd.GeoDataFrame | None) – Boundary geometry (EPSG:4326) or a GeoDataFrame to define the area whenosm_idis not given.simplify (
bool) – If True, merges the segments of the ways into edges that run from junction to junction. Segments are merged only when they carry the same tags, so an edge keeps the attributes of its ways, and bridges and tunnels stay separate edges. 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) – Which OSM tags to retain on edges. Overridesconfig.walk_useful_edges_attr(highway,name).bridgeandtunnelare always kept. Withsimplifya change of any kept tag starts a new edge.
- 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:
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.