IduEdu¶
Multimodal city networks from OpenStreetMap and GTFS¶
IduEdu is an open-source Python library that builds street, cycling, public-transport and intermodal networks of a city from OpenStreetMap and GTFS Schedule feeds, routes on them and measures them. It is developed by the IDU team at ITMO University.
Overview¶
Every network is an UrbanGraph: a table of nodes and a table of edges (GeoDataFrames in a local
metric CRS) with the edge costs length_meter (metres) and time_min (minutes). The graph algorithms run
in parallel threads in a compiled Rust extension, iduedu._rust. Every page below describes what is computed,
the method, the parameters and outputs with their units, figures and the limitations.
Topic |
Result |
Functions |
|---|---|---|
OSM data from the Overpass API or from a local |
||
Walk, drive and bike graphs with travel times, kept OSM tags, bridges and tunnels, cycling stress levels |
||
Bus, trolleybus, tram, subway, monorail and train routes from OSM, timed by a speed model per mode |
||
Public transport from GTFS Schedule feeds, with waiting times from the timetable |
||
Walking and public transport in one graph, joined at platforms and station entrances |
||
The graph model: node and edge tables, types, validation, storage, NetworkX |
||
Clipping, subgraphs, joins, components, merged junctions, objects projected onto edges |
||
Costs and routes from one or many sources, origin–destination matrices |
||
One route by bidirectional search, A* or ALT; alternative routes; k shortest routes |
||
Length, density, junctions and directness of a network, by area or zone |
||
Nearest objects, counts and sums of objects within a travel cost, diversity |
||
Reach, closeness, gravity and betweenness of nodes and edges |
||
Trips from sources spread over destinations and summed on the edges along shortest paths |
||
Heights of nodes, grades of edges, travel times that depend on the grade |
Examples contains an executable notebook for every topic.
Installation¶
pip install iduedu
IduEdu supports Python 3.11–3.14 on Linux, macOS and Windows. Wheels contain the compiled extension, so pip
needs no compiler; building from a source checkout requires a Rust toolchain (rustup).
Optional extras: iduedu[io] writes and reads .urbangraph archives, iduedu[elevation] reads elevation
rasters (rasterio). NetworkX is not installed with IduEdu and is needed only by the NetworkX helpers. Changes for
code written for 2.x are listed in Upgrading to 3.0.
Quickstart¶
The builders download the territory from the Overpass API, or read it from a local OSM file. The second way is faster for large areas and does not depend on the public Overpass instance:
import iduedu
from iduedu import get_4326_boundary, get_intermodal_graph
# Vasilyevsky Island district, Saint Petersburg (OSM relation 1114252)
with iduedu.use_pbf(osm_id=1114252, region="northwestern-fed-district"):
boundary = get_4326_boundary(osm_id=1114252)
graph = get_intermodal_graph(territory=boundary, clip_by_territory=True)
Without the with block the same calls query the Overpass API. Routes and matrices then take node ids or
GeoDataFrames of objects, which are matched to their nearest nodes:
nodes = graph.nodes_gdf.index
cost, route = graph.shortest_path(nodes[0], nodes[-1], weight="time_min") # minutes, node ids
edges = graph.path_to_edges(route) # the edges of the route with their geometry
matrix = graph.od_matrix(gdf_origins=buildings, gdf_destinations=schools, cutoff=30)
Network measures work on the same graph:
from iduedu import aggregate_objects, centrality
reach = centrality(graph, ["reach", "harmonic"], cutoffs=[10, 20], weight="time_min")
schools_within = aggregate_objects(graph, [10, 20], gdf_origins=buildings, gdf_objects=schools)
Configuration¶
Settings such as the Overpass endpoint, the response cache, a historical OSM date or the OSM tags kept on edges
live in the global config object (see Configuration):
from iduedu import config
config.set_overpass_cache(cache_dir=".iduedu_cache", enabled=True)
config.configure_logging(level="INFO")
Contributing, contacts and citation¶
Issues and pull requests are welcome on GitHub; the workflow is described
in CONTRIBUTING.md.
NCCR, National Center for Cognitive Research
IDU, Institute of Design and Urban Studies
Natalya Chichkova, project manager
Danila Oleynikov (Donny), lead software engineer
This research is financially supported by the Foundation for National Technology Initiative’s Projects Support as a part of the roadmap implementation for the development of the high-tech field of Artificial Intelligence for the period up to 2030 (agreement 70-2021-00187).
IduEdu is distributed under the BSD 3-Clause license (LICENSE.txt). To cite it, use the metadata in
CITATION.cff (on GitHub, Cite this repository
exports it as APA or BibTeX). Publications describing IduEdu will be listed here.