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.

Yuta Sato, City2Graph’s lead developer, has published two interesting articles on the package:
City2Graph: Python package for spatial network analysis and GeoAI with GNNs introduces City2Graph, its main features, and how it fits into the system of Python-based spatial data analysis packages.
In How to Use Overture Maps Like OSMnx – by City2Graph, Yuto covers how City2Graph can be used to work with, and transform, OMF data.
Footnotes
Currently v. 0.3.1.↩︎
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.↩︎
GeoPandasis an extension to the popular data science libraryPandasthat enables support for geospatial data.↩︎NetworkXis a Python library for the creation, manipulation, and study of networks and graphs.↩︎PyTorch Geometricis a library built onPyTorchfor deep learning on graph-structured data.↩︎OpenStreetMap, a collaborative, open-licensed map of the world.↩︎
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.↩︎
The General Transit Feed Specification is a data standard defining a common format for public transit schedules and associated geographic information.↩︎