Heads up This site is currently under heavy development.
← all tools
◆ AI Model & Data Infrastructure

City2Graph

v1.0.0 open-source

Transform geospatial relations into graphs for Graph Neural Networks and spatial network analysis

Summary

City2Graph is an open-source Python library that transforms buildings, streets, transport feeds, and point-of-interest data into spatial and heterogeneous graphs. It is licensed under the BSD 3-Clause license and functions as a library imported into other code. It is intended for researchers and data scientists working with geospatial data, sitting in the graph-analysis space adjacent to tools like NetworkX. The project shows signs of ongoing development, with 17 releases tracked in our records.

Transform geospatial relations into graphs for Graph Neural Networks and spatial network analysis

What City2Graph answers

What kinds of real-world data elements does it model into a graph?

buildings, streets, public transport feeds, origin–destination matrices, zones, and points of interest

Which existing Python data science libraries does it accommodate for graph creation?

GeoPandas, NetworkX, and PyTorch Geometric

What methods of mobility data can it incorporate?

origin–destination matrices and flow data such as migration, bike-sharing, and pedestrian counts

What external data feeds can it process for transportation information?

GTFS public transport and GBFS shared-mobility feeds

Does it handle different types of physical structures in the urban environment?

Yes, it handles buildings, streets, and tessellated urban fabric

Release history

  1. v1.0.0 Aug 1, 2026 · issue 004

    City2Graph v1.0.0 adds morphological_graphs(), GBFS shared-mobility loading, and deprecates the as_nx parameter.

    └──▷ GET THIS VERSION
    $ git clone --branch v1.0.0 https://github.com/c2g-dev/city2graph.git
    # already have the repo? check out this version:
    $ git checkout v1.0.0
    └──▷ USE IT
    Build morphological graphs for multiple urban areas in one call using the new batch function.
    python
    import city2graph
    
    graphs = city2graph.morphological_graphs(buildings_gdf, tessellation_gdf)
    • Adds morphological_graphs() function (plural) for batch morphological graph construction, with improved error handling for GeometryCollection inputs.
    • Expands options on morphological_graph() (singular) for finer control over morphological graph generation.
    • Adds GBFS shared-mobility feed loading support, joining the existing GTFS pipeline for transit data ingestion into DuckDB.
    • Adds DeprecationWarning on the as_nx parameter to signal its forthcoming removal.
    • Replaces dense proximity distance matrices with sparse neighbor queries, reducing memory pressure for large spatial graphs.
my-toolchain — 0 tools
paste an install list to detect your tools

A brew list, a Brewfile, requirements.txt, a Dockerfile — or just the product names, free-form. Nothing leaves your browser.

    browse all tools →