High-level functions

Graph builders

The OSM high-level builders download OpenStreetMap data, while the GTFS builder reads a local Schedule feed. Both normalize their inputs into the UrbanGraph data model, use 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. OSM-based public transport uses the active TransportRegistry; GTFS graphs derive in-vehicle and boarding times from the selected schedule.

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.

OSM public-transport and intermodal graphs

Use get_public_transport_graph() to build bus, trolleybus, tram, subway, monorail, or share-taxi (taxi) graphs. Pass transport_types to restrict modes and transport_registry to customize time calculation. A requested type must exist in the registry, otherwise the builder raises ValueError: trains need a registry that defines them, such as DEFAULT_REGISTRY_W_TRAIN. OSM light_rail routes are fetched as tram and share_taxi routes as taxi. See Transport registry.

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.

GTFS public-transport graphs

Use get_gtfs_public_transport_graph() to build a static graph from a local GTFS Schedule directory or ZIP archive. A list of feeds is merged with merge_gtfs_feeds() first. Service-date and time-window filters select the departures used to estimate boarding waits. GTFS graphs do not use TransportRegistry waiting-time defaults.

To make a GTFS graph intermodal, first build a walk graph, pass its CRS to the GTFS builder, and combine the two with join_pt_walk_graph(). See GTFS public transport for the complete workflow and modeling details.

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_gtfs_public_transport_graph

Build a static public-transport UrbanGraph from a local GTFS feed.

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.