{"id":30860538,"url":"https://github.com/c2g-dev/city2graph","last_synced_at":"2026-04-01T22:26:59.061Z","repository":{"id":272955102,"uuid":"918287261","full_name":"c2g-dev/city2graph","owner":"c2g-dev","description":"Transform geospatial relations into graphs for Graph Neural Networks and network analysis","archived":false,"fork":false,"pushed_at":"2026-03-21T23:37:06.000Z","size":313137,"stargazers_count":799,"open_issues_count":3,"forks_count":68,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-03-22T12:40:49.129Z","etag":null,"topics":["geoai","geographic-data-science","geographical-information-system","geospatial","geospatial-analysis","gis","gnn","graph-neural-networks","graph-representation-learning","mobility","network-analysis","overturemaps","pyg","python","pytorch","pytorch-geometric","spatial-analysis","transportation","urban-morphometrics"],"latest_commit_sha":null,"homepage":"https://city2graph.net","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/c2g-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"docs/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-17T16:13:41.000Z","updated_at":"2026-03-22T11:17:48.000Z","dependencies_parsed_at":"2025-01-17T17:28:27.491Z","dependency_job_id":"0d45410b-1810-4589-be9b-9af00af7ca5b","html_url":"https://github.com/c2g-dev/city2graph","commit_stats":null,"previous_names":["yu-ta-sato/city2graph","c2g-dev/city2graph"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/c2g-dev/city2graph","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c2g-dev%2Fcity2graph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c2g-dev%2Fcity2graph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c2g-dev%2Fcity2graph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c2g-dev%2Fcity2graph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/c2g-dev","download_url":"https://codeload.github.com/c2g-dev/city2graph/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c2g-dev%2Fcity2graph/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31292639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T21:15:39.731Z","status":"ssl_error","status_checked_at":"2026-04-01T21:15:34.046Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geoai","geographic-data-science","geographical-information-system","geospatial","geospatial-analysis","gis","gnn","graph-neural-networks","graph-representation-learning","mobility","network-analysis","overturemaps","pyg","python","pytorch","pytorch-geometric","spatial-analysis","transportation","urban-morphometrics"],"created_at":"2025-09-07T16:05:59.714Z","updated_at":"2026-04-01T22:26:59.049Z","avatar_url":"https://github.com/c2g-dev.png","language":"Python","readme":"# City2Graph: GeoAI with Graph Neural Networks (GNNs) and Spatial Network Analysis\n\n[![City2Graph](http://city2graph.net/latest/assets/logos/social_preview_city2graph.png)](http://city2graph.net/latest/assets/logos/social_preview_city2graph.png)\n\n**City2Graph** is a Python library for converting geospatial datasets into graph representations, providing an integrated interface for [GeoPandas](https://geopandas.org/), [NetworkX](https://networkx.org/), and [PyTorch Geometric](https://pytorch-geometric.readthedocs.io/en/latest/) across multiple domains (e.g. streets, transportations, OD matrices, POI proximities, etc.). It enables researchers and practitioners to seamlessly develop advanced GeoAI and geographic data science applications. For more information, please visit the [documentation](https://city2graph.net).\n\n[![PyPI version](https://badge.fury.io/py/city2graph.svg)](https://badge.fury.io/py/city2graph/) [![conda-forge Version](https://anaconda.org/conda-forge/city2graph/badges/version.svg)](https://anaconda.org/conda-forge/city2graph/) [![PyPI Downloads](https://static.pepy.tech/badge/city2graph)](https://pepy.tech/projects/city2graph) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.15858845.svg)](https://doi.org/10.5281/zenodo.15858845) [![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://github.com/c2g-dev/city2graph/blob/main/LICENSE)\n[![Platform](https://anaconda.org/conda-forge/city2graph/badges/platforms.svg\n)](https://anaconda.org/conda-forge/city2graph) [![codecov](https://codecov.io/gh/c2g-dev/city2graph/graph/badge.svg?token=2R449G75Z0)](https://codecov.io/gh/c2g-dev/city2graph) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n\n## Features\n\n[![scope](http://city2graph.net/latest/assets/figures/scope.png)](http://city2graph.net/latest/assets/figures/scope.png)\n\n- **Graph Construction for GeoAI:** Build graphs from diverse urban datasets, including buildings, streets, and land use, to power GeoAI and GNN applications.\n- **Transportation Network Modeling:** Query GTFS feeds through DuckDB and construct detailed transit graphs for accessibility and service analysis.\n- **Proximity and Contiguity Analysis:** Create graphs based on spatial proximity and adjacency, including multi-center distance filtering and layered isochrones.\n- **Mobility Flow Analysis:** Model and analyze urban mobility patterns from various data sources like bike-sharing, migration, and pedestrian flows.\n- **PyTorch Geometric Integration:** Seamlessly convert geospatial data into PyTorch tensors for GNNs.\n\n## Installation\n\n### Using pip\n\n#### Basic Installation\n\nThe simplest way to install City2Graph is via pip:\n\n```bash\npip install city2graph\n```\n\nThis installs the core functionality without PyTorch and PyTorch Geometric.\n\n#### With PyTorch (CPU)\n\nIf you need the Graph Neural Networks functionality, install with the `cpu` option:\n\n```bash\npip install \"city2graph[cpu]\"\n```\n\nThis will install PyTorch and PyTorch Geometric with CPU support, suitable for development and small-scale processing.\n\n#### With PyTorch + CUDA (GPU)\n\nFor GPU acceleration, you can install City2Graph with a specific CUDA version extra. For example, for CUDA 13.0:\n\n```bash\npip install \"city2graph[cu130]\"\n```\n\nSupported CUDA versions are `cu126`, `cu128`, and `cu130`.\n\n### Using conda\n\n#### Basic Installation\n\nYou can also install City2Graph using conda from conda-forge:\n\n```bash\nconda install -c conda-forge city2graph\n```\n\nThis installs the core functionality without PyTorch and PyTorch Geometric.\n\n#### With PyTorch (CPU)\n\nTo use PyTorch and PyTorch Geometric with City2Graph installed from conda-forge, you need to manually add these libraries to your environment:\n\n```bash\n# Install city2graph\nconda install -c conda-forge city2graph\n\n# Then install PyTorch and PyTorch Geometric\nconda install -c conda-forge pytorch pytorch_geometric\n```\n\n#### With PyTorch + CUDA (GPU)\n\nFor GPU support, you should select the appropriate PyTorch variant by specifying the version and CUDA build string. For example, to install PyTorch 2.9.0 with CUDA 12.8 support:\n\n```bash\n# Install city2graph\nconda install -c conda-forge city2graph\n\n# Then install PyTorch with CUDA support\nconda install -c conda-forge pytorch=2.9.0=*cuda128*\nconda install -c conda-forge pytorch_geometric\n```\n\nYou can browse available CUDA-enabled builds on the [conda-forge PyTorch files page](https://anaconda.org/conda-forge/pytorch/files) and substitute the desired version and CUDA variant in your install command. Make sure that the versions of PyTorch and PyTorch Geometric you install are compatible with each other and with your system.\n\n**⚠️ Important:** conda is not officially supported by PyTorch and PyTorch Geometric anymore, and only conda-forge distributions are available for them. We recommend using pip or uv for the most streamlined installation experience if you need PyTorch functionality.\n\n## For Development\n\nIf you want to contribute to City2Graph, you can set up a development environment using `uv`.\n\n```bash\n# Install uv if you haven't already done it\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n\n# Clone the repository\ngit clone https://github.com/c2g-dev/city2graph.git\ncd city2graph\n\n# Install development dependencies with a PyTorch variant (e.g., cpu or cu128)\nuv sync --extra cpu --group dev\n```\n\nYou can then run commands within the managed environment:\n\n```bash\n# Add IPython kernel for interactive development\nuv run ipython kernel install --name \"your-env-name\" --user\n\n# Or start Jupyter Notebook\nuv run jupyter notebook\n```\n\n### Development Environment\n\nThe development dependencies include:\n- `ipython`: Enhanced interactive Python shell with Jupyter kernel support\n- `jupyter` and `notebook`: For running Jupyter notebooks with project-specific kernel\n- `isort`: Code formatting tools\n- `pytest` and `pytest-cov`: Testing tools\n\nThe Jupyter kernel installation ensures that when you start Jupyter notebooks, you can select the \"city2graph\" kernel which has access to all your project dependencies in the correct virtual environment.\n\n### Using Docker Compose\n\nBefore using Docker Compose, ensure you have Docker and Docker Compose installed on your system:\n\n```bash\n# Check Docker installation\ndocker --version\n\n# Check Docker Compose installation\ndocker compose version\n```\n\nIf these commands don't work, you need to install Docker first:\n- For macOS: Install [Docker Desktop](https://www.docker.com/products/docker-desktop)\n- For Linux: Follow the [installation instructions](https://docs.docker.com/engine/install/) for your specific distribution\n- For Windows: Install [Docker Desktop](https://www.docker.com/products/docker-desktop)\n\nOnce Docker is installed, clone the repository and start the containers:\n\n```bash\n# Clone the repository\ngit clone https://github.com/yu-ta-sato/city2graph.git\ncd city2graph\n\n# Build and run in detached mode\ndocker compose up -d\n\n# Access Jupyter notebook at http://localhost:8888\n\n# Stop containers when done\ndocker compose down\n```\n\nYou can customize the services in the `docker-compose.yml` file according to your needs.\n\n## Citation\n\nIf you use City2Graph in your research, please cite it as follows:\n\n```bibtex\n@software{sato2025city2graph,\n  title = {City2Graph: Transform geospatial relations into graphs for spatial network analysis and Graph Neural Networks},\n  author = {Sato, Yuta},\n  year = {2025},\n  url = {https://github.com/c2g-dev/city2graph},\n  doi = {10.5281/zenodo.15858845},\n}\n```\n\nYou can also use the DOI to cite a specific version: [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.15858845.svg)](https://doi.org/10.5281/zenodo.15858845)\n\nAlternatively, you can find the citation information in the [CITATION.cff](CITATION.cff) file in this repository, which follows the Citation File Format standard.\n\n## Contributing\n\nWe welcome contributions to the City2Graph project! To contribute:\n\n1. **Fork and clone the repository:**\n   ```bash\n   git clone https://github.com/\u003cyour-name\u003e/city2graph.git\n   cd city2graph\n   git remote add upstream https://github.com/c2g-dev/city2graph.git\n   ```\n\n2. **Set up the development environment:**\n   ```bash\n   uv sync --group dev --extra cpu\n   source .venv/bin/activate  # On Windows: .venv\\Scripts\\activate\n   ```\n\n3. **Create a feature branch:**\n   ```bash\n   git checkout -b your-feature-name\n   ```\n\n4. **Make your changes and test:**\n   ```bash\n   # Run pre-commit checks\n   uv run pre-commit run --all-files\n\n   # Run tests\n   uv run pytest -q\n   ```\n\n5. **Submit a pull request** with a clear description of your changes.\n\nFor detailed contributing guidelines, code style requirements, and documentation standards, please see our [Contributing Guide](docs/contributing.md).\n\n## Code Quality\n\nWe maintain strict code quality standards using:\n- **Ruff**: For linting and formatting\n- **mypy**: For static type checking\n- **numpydoc**: For docstring style validation\n\nAll contributions must pass pre-commit checks before being merged.\n\n## Documentation\n\nCity2Graph uses **MkDocs** for current documentation (v0.2.0+) and keeps **Sphinx** for legacy releases (v0.1.0–v0.1.7).\n\n- **Legacy tags** (`v0.1.*`): Read the Docs builds `docs/source` via Sphinx.\n- **Everything else** (branches / newer tags): Read the Docs builds via MkDocs (`mkdocs.yml`).\n\nThis is controlled in `.readthedocs.yaml` using `READTHEDOCS_VERSION_TYPE` and `READTHEDOCS_VERSION_NAME`.\n\n[![GeoGraphic Data Science Lab](https://github.com/user-attachments/assets/569b9550-9a48-461d-a408-18d7a5dfc78c)](https://www.liverpool.ac.uk/geographic-data-science/)\n","funding_links":[],"categories":["Python","Geospatial Library"],"sub_categories":["Python"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fc2g-dev%2Fcity2graph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fc2g-dev%2Fcity2graph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fc2g-dev%2Fcity2graph/lists"}