8000 GitHub - IDUclub/IduEdu: Creation and manipulation of city networks from OpenStreetMap. · GitHub
[go: up one dir, main page]

Skip to content
IDUclubPublic

About

Creation and manipulation of city networks from OpenStreetMap.

Topics

Resources

Contributing

Stars

16 stars

Watchers

2 watching

Forks

Repository files navigation

IduEdu

Code style: black PyPI version Tests and Coverage Coverage License Docs GitHub

IduEdu logo banner

IduEdu is an open-source Python library for building and analysing multimodal city networks. It reads OpenStreetMap from the Overpass API or a local .osm.pbf file and GTFS Schedule feeds, builds walk, drive, bike, public-transport and intermodal graphs, and keeps them as UrbanGraph objects: GeoDataFrame tables of nodes and edges with their geometry, CRS and travel times. Routing, matrices, accessibility and centralities run in a compiled Rust core.

Documentation: https://iduclub.github.io/IduEdu/

What it does

Task Functions Guide
OSM data from Overpass or a Geofabrik .osm.pbf cut to the territory use_pbf, download_osm_pbf, split_by_polygons Data sources
Points of interest, buildings, land use by OSM tags get_osm_features OSM features
Walk, drive and bike graphs; cycling stress levels, kept OSM tags get_walk_graph, get_drive_graph, get_bike_graph Street graphs
Public transport from OSM routes, timed by a speed model per mode get_public_transport_graph, TransportRegistry Public transport
Public transport from GTFS feeds, waits from the timetable, several feeds merged get_gtfs_public_transport_graph, merge_gtfs_feeds GTFS
Walking and public transport in one graph get_intermodal_graph, join_pt_walk_graph Intermodal graphs
Graph tables, validation, .urbangraph archives, NetworkX conversion UrbanGraph, read_urban_graph UrbanGraph model
Clipping, joins, components, scenario edits, objects projected onto edges clip_urban_graph, apply_urban_graph_changes Graph operations
Costs and routes from many sources, origin-destination matrices od_matrix, single_source_dijkstra Shortest paths
One route by bidirectional search, A* or ALT; alternatives; k shortest routes shortest_path, k_shortest_paths Point to point
Length, density, junctions and directness by area or zone graph_stats, local_stats Statistics
Nearest objects, sums and diversity of objects within a travel cost aggregate_objects, nearest_objects Objects
Reach, closeness, gravity and betweenness centrality, edge_betweenness Centrality
Trips spread over destinations and summed on the edges assign_flows Flows
Heights, grades and travel times that depend on the slope add_elevation, apply_grade_speed Elevation

Every topic has an executable notebook among the examples; all functions are listed in the API reference.

Performance

IduEdu was compared with the Python tools commonly used for the same tasks, each given the same input data. Street graphs are built 5–16 times faster than with OSMnx and 2–19 times faster than with Pyrosm, and take 7–24 times less memory. Origin-destination matrices are computed 3–25 times faster than with NetworKit and far faster than with igraph or rustworkx. Public-transport graphs from GTFS are built 3.5–7 times faster than with peartree with 1.6–2.7 times less memory.

IduEdu against common Python tools

The protocol, the tables per city and the figures for every comparison are on the performance page.

Installation

pip install iduedu

Python 3.11–3.14 on Linux, macOS and Windows. Wheels contain the compiled Rust core; building from source needs a stable Rust toolchain (1.82 or newer). Extras: iduedu[io] for .urbangraph archives, iduedu[elevation] for elevation rasters. NetworkX is optional and needed only by the conversion helpers. Coming from 2.x: see Upgrading to 3.0.

Quickstart

import iduedu
from iduedu import get_4326_boundary, get_intermodal_graph

# Vasilyevsky Island district, Saint Petersburg (OSM relation 1114252), read from the Geofabrik extract
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)

graph.nodes_gdf, graph.edges_gdf  # GeoDataFrames; edges carry u, v, geometry, length_meter, time_min

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)  # objects snap to nodes

Without the with block the same calls query the Overpass API. GTFS feeds go to get_gtfs_public_transport_graph("feed.zip", service_date=..., start_time=..., end_time=...). The Overpass endpoint, response cache, historical OSM date and kept tags are set on the global config object, see the configuration guide.

Development

uv sync --all-groups   # builds the Rust extension
make test              # unit tests, no network
make lint
make docs

CONTRIBUTING.md describes testing, Conventional Commits and releases. Releases are made by python-semantic-release from the commits on main; versions and tags are never set by hand.

Contacts

Acknowledgments

Реализовано при финансовой поддержке Фонда поддержки проектов Национальной технологической инициативы в рамках реализации "дорожной карты" развития высокотехнологичного направления "Искусственный интеллект" на период до 2030 года (Договор № 70-2021-00187)

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)

License

IduEdu is distributed under the BSD 3-Clause License. See LICENSE.txt for details.

Citing IduEdu

If you use IduEdu in research, please cite it. Citation metadata is kept in CITATION.cff; on GitHub, Cite this repository in the repository sidebar copies it as APA or BibTeX. Publications describing IduEdu will be listed below.

Publications

Coming soon...

About

Creation and manipulation of city networks from OpenStreetMap.

Topics

Resources

Contributing

Stars

16 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages

0