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_meterEdge geometry length in meters.
time_minTraversal 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 activeTransportRegistry; 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:
simplifyMerge raw OSM way segments into longer graph edges. Use
Falsewhen the full per-segment topology is required.clip_by_territoryClip edge geometries to the exact territory boundary before graph assembly.
keep_largest_subgraphRemove 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.
Build a drivable UrbanGraph from OpenStreetMap within a given territory. |
|
Build a pedestrian UrbanGraph from OpenStreetMap within a given territory. |
|
Build a directed public-transport graph for one or multiple transport modes within a territory. |
|
Build a static public-transport |
|
Build an intermodal (PT+walking) |
|
Join public-transport and pedestrian |