https://github.com/cityjson/flatcitybuf

CityJSON encoding with FlatBuffers

https://github.com/cityjson/flatcitybuf

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 4 committers (25.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.2%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

CityJSON encoding with FlatBuffers

Basic Info
  • Host: GitHub
  • Owner: cityjson
  • License: other
  • Language: Rust
  • Default Branch: main
  • Homepage:
  • Size: 13.8 MB
Statistics
  • Stars: 18
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 4
Created almost 2 years ago · Last pushed 11 months ago
Metadata Files
Readme Contributing License

README.md

FlatCityBuf 🏙️

![FlatCityBuf Logo](./docs/logo.png) **A cloud-optimized binary format for storing and retrieving 3D city models** [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/HideBa/flatcitybuf) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Rust](https://img.shields.io/badge/rust-%23000000.svg?style=flat&logo=rust&logoColor=white)](https://www.rust-lang.org/) [![WebAssembly](https://img.shields.io/badge/WebAssembly-654FF0?style=flat&logo=webassembly&logoColor=white)](https://webassembly.org/) *Bringing the semantic richness of CityJSON with the performance of FlatBuffers* [🚀 Getting Started](#-getting-started) • [📊 Benchmarks](#-performance--benchmarks) • [📖 Documentation](#-documentation) • [🤝 Contributing](#-contributing)

✨ Overview

FlatCityBuf revolutionizes 3D city model storage and retrieval by combining the semantic richness of CityJSON with the performance benefits of FlatBuffers binary serialization and advanced spatial indexing techniques.

Demo

Web prototype can be available from here!

https://github.com/user-attachments/assets/ab49f026-1907-4a25-a5fb-8bc69e9a102b

🎯 Why FlatCityBuf?

Traditional CityJSON formats face significant challenges in large-scale urban applications:

  • Slow parsing: Entire files must be loaded and parsed
  • Memory intensive: High memory consumption for large datasets
  • No spatial queries: Lack of efficient spatial indexing
  • Limited cloud support: Poor performance with remote data access

🚀 Key Features

| Feature | Benefit | |---------|---------| | ⚡ Zero-copy Access | Access specific city objects without parsing entire files | | ☁️ Cloud Optimized | HTTP range requests for partial data retrieval | | 🗺️ Spatial Indexing | Packed R-tree for lightning-fast spatial queries | | 🔍 Attribute Indexing | Static B+Tree for instant attribute-based filtering | | 🌐 Multi-platform | Rust core with WASM bindings for web applications |


🚄 Performance & Benchmarks

FlatCityBuf delivers 10-20× faster data retrieval compared to CityJSONTextSequence formats:

Speed Comparison Results

| Dataset | CityJSON | FlatCityBuf | Speed Improvement | Memory Reduction | |---------|---------------|------------------|---------------------|------------------| | 3DBAG | 56 ms | 6 ms | 8.6× | 4.7× less memory | | 3DBV | 3.8 s | 122ms | 32.6× | 4.5× less memory | | Helsinki | 4.0 s | 132ms | 30.6× | 2.9× less memory | | NYC | 887 ms | 43 ms | 20.7× | 4.1× less memory |

📈 Performance: 8.6-256× faster queries with 2.1-6.4× less memory usage


🏗️ Project Structure

flatcitybuf/ ├── 📦 fcb_core/ # Core library for reading/writing FlatCityBuf ├── 🛠️ fcb_cli/ # Command-line interface and tools ├── 🌐 fcb_wasm/ # WebAssembly bindings for browsers ├── 📚 docs/ # Documentation and examples └── 🧪 examples/ # Usage examples and tutorials

Technology Stack

  • Core: Rust with zero-copy deserialization
  • Serialization: FlatBuffers schema with custom optimizations
  • Spatial Index: Packed R-tree for efficient range queries
  • Attribute Index: Static B+Tree for attribute indexing
  • Web Support: WebAssembly bindings via wasm-pack
  • CLI: Comprehensive command-line tools

🚀 Getting Started

Prerequisites

  • Rust toolchain (1.83.0 or later)
  • wasm-pack (for WebAssembly builds)

📦 Installation

Package Manager Installation

Python: Install from PyPI

bash pip install flatcitybuf

JavaScript/TypeScript: Install from npm

bash npm install @cityjson/flatcitybuf

Build from Source

```bash

Clone the repository

git clone https://github.com/HideBa/flatcitybuf.git cd flatcitybuf/src/rust

Build the core library and CLI

cargo build --workspace --all-features --exclude fcb_wasm --release

Build WebAssembly module (optional)

cd wasm && wasm-pack build --target web --release --out-dir ../../ts ```

🛠️ CLI Usage

Convert CityJSONSeq to FlatCityBuf

replace cargo run -p fcb_cli with fcb in the following commands if you want to use the binary directly.

```bash

Basic conversion

cargo run -p fcb_cli ser -i input.city.jsonl -o output.fcb

With compression and indexing options

cargo run -p fcb_cli ser -i data.city.jsonl -o data.fcb

With spatial index and attribute index

cargo run -p fcbcli ser -i data.city.jsonl -o data.fcb --attr-index attributename,attribute_name2 --attr-branching-factor 256

Show information about the file

cargo run -p fcb_cli info -i data.fcb ```

🧪 Run Benchmarks

```bash

Core reading benchmarks

cargo bench -p fcb_core --bench read -- --release ```


📚 Documentation


🤝 Contributing

We welcome contributions from the community! Please see our Contributing Guidelines for details on:

  • 🐛 Reporting bugs
  • 💡 Requesting features
  • 🔧 Submitting pull requests
  • 📝 Improving documentation

🙏 Acknowledgements & Special Thanks

Core Contributors

This project builds upon the excellent work of the geospatial and 3D GIS community:

Technical Foundations

  • FlatGeobuf - FlatGeobuf team Licensed under BSD 2-Clause License. Provided the foundational spatial indexing algorithms and FlatBuffers integration patterns.

  • CityBuf - 3DBAG organisation Original FlatBuffers schema for CityJSON features, authored by Ravi Peters (3DGI) and Balázs Dukai (3DGI).

Standards & Specifications

  • CityJSON - For the semantic foundation of 3D city models
  • FlatBuffers - Google's cross-platform serialization library
  • OGC CityGML - International standard for 3D city models

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

📖 Citation

If you use FlatCityBuf in your research, please cite:

bibtex @article{flatcitybuf, title={FlatCityBuf: a new cloud-optimised CityJSON format}, author={[Hidemichi Baba, Hugo Ledoux, Ravi Peters]}, year={2025}, url={https://repository.tudelft.nl/record/uuid:6727c979-5e46-4fe0-9349-a7803e825d02} }


**[⭐ Star us on GitHub](https://github.com/HideBa/flatcitybuf)** • **[🐛 Report Issues](https://github.com/HideBa/flatcitybuf/issues)** • **[💬 Discussions](https://github.com/HideBa/flatcitybuf/discussions)**

Owner

  • Name: CityJSON
  • Login: cityjson
  • Kind: organization

For all CityJSON matters. Managed by @tudelft3d

GitHub Events

Total
  • Release event: 4
  • Watch event: 2
  • Delete event: 10
  • Push event: 58
  • Pull request event: 8
  • Create event: 9
Last Year
  • Release event: 4
  • Watch event: 2
  • Delete event: 10
  • Push event: 58
  • Pull request event: 8
  • Create event: 9

Committers

Last synced: 12 months ago

All Time
  • Total Commits: 154
  • Total Committers: 4
  • Avg Commits per committer: 38.5
  • Development Distribution Score (DDS): 0.019
Past Year
  • Commits: 154
  • Committers: 4
  • Avg Commits per committer: 38.5
  • Development Distribution Score (DDS): 0.019
Top Committers
Name Email Commits
HideBa b****a@g****m 151
deepsource-io[bot] 4****] 1
Hugo Ledoux h****x@t****l 1
Ravi Peters r****i@y****l 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

Packages

  • Total packages: 2
  • Total downloads:
    • npm 240 last-month
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 0
    (may contain duplicates)
  • Total versions: 4
  • Total maintainers: 4
pypi.org: flatcitybuf

Python bindings for FlatCityBuf - a cloud-optimized binary format for 3D city models

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 8.7%
Stargazers count: 15.6%
Forks count: 23.8%
Average: 24.3%
Dependent repos count: 49.0%
Maintainers (1)
Last synced: 11 months ago
npmjs.org: @cityjson/flatcitybuf

FlatCityBuf is a library for reading and writing CityJSON with FlatBuffers.

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 240 Last month
Rankings
Dependent repos count: 24.1%
Average: 29.5%
Dependent packages count: 34.8%
Maintainers (3)
Last synced: 11 months ago

Dependencies

.github/workflows/ci.yaml actions
  • Swatinem/rust-cache v2 composite
  • actions/checkout v4 composite
  • dtolnay/rust-toolchain stable composite
src/rust/Cargo.toml cargo
  • criterion 0.5.1 development
  • pretty_assertions 1.4.1 development
  • anyhow 1.0.95
  • byteorder 1.5.0
  • clap 4.5.23
  • fallible-streaming-iterator 0.1.9
  • flatbuffers 24.3.25
  • serde_json 1.0.133
  • tempfile 3.14.0
src/py/poetry.lock pypi
  • black 24.8.0
  • click 8.1.7
  • colorama 0.4.6
  • flake8 7.1.1
  • flatbuffers 24.3.25
  • iniconfig 2.0.0
  • isort 5.13.2
  • mccabe 0.7.0
  • mypy 1.11.2
  • mypy-extensions 1.0.0
  • packaging 24.1
  • pathspec 0.12.1
  • platformdirs 4.3.3
  • pluggy 1.5.0
  • pycodestyle 2.12.1
  • pyflakes 3.2.0
  • pytest 8.3.3
  • typing-extensions 4.12.2
src/py/pyproject.toml pypi
  • black ^24.8.0 develop
  • flake8 ^7.1.1 develop
  • isort ^5.13.2 develop
  • mypy ^1.11.2 develop
  • pytest ^8.3.3 develop
  • flatbuffers ^24.3.25
  • python ^3.11