Metadata-Version: 2.5
Name: flatcitybuf
Version: 0.5.0
Summary: Pure-Python reader for FlatCityBuf, a cloud-optimized binary format for 3D city models
Requires-Python: >=3.9
Requires-Dist: flatbuffers>=24.3.25
Provides-Extra: dev
Requires-Dist: mypy>=1.11; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.12; extra == 'dev'
Provides-Extra: docs
Requires-Dist: pdoc>=15; extra == 'docs'
Provides-Extra: numpy
Requires-Dist: numpy>=1.21; extra == 'numpy'
Description-Content-Type: text/markdown

# flatcitybuf

A from-scratch, pure-Python reader for
[FlatCityBuf](https://github.com/cityjson/flatcitybuf), a cloud-optimized
binary format for 3D city models: CityJSON's semantics in FlatBuffers, with a
packed Hilbert R-tree for spatial queries, a static B+tree for attribute
queries, and HTTP range requests so a client fetches only the bytes it needs.
No FFI and no compiled extension — a single `py3-none-any` wheel on CPython
3.9+, with `flatbuffers` as its only required dependency. Reader only: write
`.fcb` files with the Rust CLI or the C++ writer.

```bash
pip install flatcitybuf          # or: uv pip install flatcitybuf
pip install "flatcitybuf[numpy]" # optional: ~2.4x faster bulk decoding
```

```python
import json
import flatcitybuf as fcb

reader = fcb.FcbReader.open_file("city.fcb")

# The CityJSONSeq header line.
print(json.dumps(fcb.to_cityjson_metadata(reader.header)))

# Every feature, in stored (Hilbert) order.
for feature in reader.select_all():
    cj = fcb.to_cityjson_feature(feature, reader.header)

# Over HTTP, byte-range by byte-range (synchronously).
remote = fcb.FcbReader.open(fcb.HttpRangeReader("https://example.com/city.fcb"))
```

Attribute and spatial queries, the optional-numpy story, development commands,
and the migration notes for users of the retired PyO3 extension (0.2.0 and
earlier, whose API this does **not** drop-in replace) are all in the guide:

- **[Python guide](https://github.com/cityjson/flatcitybuf/blob/main/docs/py.md)**
  — install, full API tour, tooling and testing.
- **[Runnable examples](https://github.com/cityjson/flatcitybuf/blob/main/src/py/examples/README.md)**
  — eight scripts, one per capability, each with its real output. They run as
  part of the test suite, so they cannot drift.
- [Format specification](https://github.com/cityjson/flatcitybuf/blob/main/docs/specification.md)
- [Project README](https://github.com/cityjson/flatcitybuf/blob/main/README.md)
- [Issue tracker](https://github.com/cityjson/flatcitybuf/issues)

## License

MIT — see
[LICENSE](https://github.com/cityjson/flatcitybuf/blob/main/LICENSE).
