High-level functions

Graph builders

The high-level builders download OpenStreetMap data, normalize it into the UrbanGraph data model, estimate a local metric CRS, and compute standard edge weights:

length_meter

Edge geometry length in meters.

time_min

Traversal time in minutes. For walk graphs this is based on walk_speed; for drive graphs it is based on road class and speed tags; for public transport it is based on the active TransportRegistry.

Most examples use osm_id=1114252 and can be run directly from the notebooks. See Build transport graphs for end-to-end examples of all builders.

Drive and walk graphs

Use get_drive_graph() for car-accessible street networks and get_walk_graph() for pedestrian networks. Both functions support:

simplify

Merge raw OSM way segments into longer graph edges. Use False when the full per-segment topology is required.

clip_by_territory

Clip edge geometries to the exact territory boundary before graph assembly.

keep_largest_subgraph

Remove disconnected fragments. Directed graphs use the largest strongly connected component by default.

The Build transport graphs notebook shows simplify=True and simplify=False side by side and highlights edges affected by clipping.

Public-transport and intermodal graphs

Use get_public_transport_graph() to build bus, tram, trolleybus, subway, or train graphs. Pass transport_types to restrict modes and transport_registry to customize time calculation.

Use join_pt_walk_graph() when you already have public-transport and walk graphs. Use get_intermodal_graph() to build both networks and join them in one call. Public-transport platform-like nodes are projected to nearby walk edges, optionally creating link edges.

See Build transport graphs for intermodal construction and Objects, nearest nodes, and graph projection for the lower-level projection workflow used during joining.

get_drive_graph

Build a drivable UrbanGraph from OpenStreetMap within a given territory.

get_walk_graph

Build a pedestrian UrbanGraph from OpenStreetMap within a given territory.

get_public_transport_graph

Build a directed public-transport graph for one or multiple transport modes within a territory.

get_intermodal_graph

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

join_pt_walk_graph

Join public-transport and pedestrian UrbanGraph objects into an intermodal graph.