City2Graph: Easy graph generation in Python

#City2Graph is an open-source #Python package that turns geospatial data into #graph structures for #NetworkAnalysis and Graph Neural Networks, with seamless integration into tools like #GeoPandas, #NetworkX, and #PyTorch Geometric. It supports diverse data sources from #OSM and #GTFS to #OMF making relevant spatial datasets easy to access and work with.
Author
Published

April 18, 2026

City2Graph is a new1 Python package for transforming geospatial data into graph representations for Graph Neural Networks2 and for network analysis. It’s open-source under the BSD-3-Clause license.

It integrates well with GeoPandas3, NetworkX4, and Pytorch Geometric5, works with data of different domains (for example, streets, public transit, origin-destionation matrices, POIs, and more) and can use various data sources such as OSM6, OMF7, and publishers of GTFS8 data. City2Graph makes it particularly easy to work with (initially not very easy to obtain) OMF data.

City2Graph inputs and outputs (source: Yuta Sato)

Yuta Sato, City2Graph’s lead developer, has published two interesting articles on the package:

Footnotes

  1. Currently v. 0.3.1.↩︎

  2. Graph Neural Networks (GNNs) are a class of deep learning models designed to operate directly on graph-structured data by learning representations through aggregating information from neighboring nodes and edges.↩︎

  3. GeoPandas is an extension to the popular data science library Pandas that enables support for geospatial data.↩︎

  4. NetworkX is a Python library for the creation, manipulation, and study of networks and graphs.↩︎

  5. PyTorch Geometric is a library built on PyTorch for deep learning on graph-structured data.↩︎

  6. OpenStreetMap, a collaborative, open-licensed map of the world.↩︎

  7. The Overture Maps Foundation is an industry consortium (members include Amazon, Meta, Microsoft, and TomTom) that produces openly-licensed map data, building primarily on OpenStreetMap data.↩︎

  8. The General Transit Feed Specification is a data standard defining a common format for public transit schedules and associated geographic information.↩︎