cityjson-lib
Python bindings for the cityjson-lib
Rust crate — a higher-level read/write facade for
CityJSON 2.0.
The distribution name is cityjson-lib; the import name is cityjson_lib.
Under the hood the package ships a prebuilt native library (built from the
Rust C-ABI core) and a thin ctypes wrapper — no Rust toolchain or compiler
is required on the user side.
Install
pip install cityjson-lib
Prebuilt wheels are published for:
- Linux x86_64 (manylinux)
- macOS x86_64 and arm64
- Windows AMD64
Python 3.11, 3.12, and 3.13 are supported.
Quick start
from cityjson_lib import CityModel, probe_bytes
payload = open("model.city.json", "rb").read()
probe = probe_bytes(payload)
print(probe.root_kind, probe.version)
model = CityModel.parse_document_bytes(payload)
summary = model.summary()
print(summary.model_type, summary.cityobject_count)
For an end-to-end authoring example that exercises the full public Python
API, see examples/fake_complete.py.
Selection and merge workflows
CityModel.subset_cityobjects(...) remains the simple helper for extracting
whole CityObjects by id. For workflows that need relationship expansion,
geometry-level selection, or set operations, use ModelSelection and then
materialize the result with CityModel.extract_selection(...).
from cityjson_lib import CityModel, GeometrySelectionSpec, ModelSelection, merge_models
model = CityModel.parse_document_bytes(open("model.city.json", "rb").read())
selection = ModelSelection.select_cityobjects_by_id(model, ["building-part-1"])
with_relatives = selection.include_relatives(model)
extracted = model.extract_selection(with_relatives)
first_geometry = ModelSelection.select_geometries_by_cityobject_id_and_index(
model,
[GeometrySelectionSpec("building-1", 0)],
)
second_geometry = ModelSelection.select_geometries_by_cityobject_id_and_index(
model,
[("building-1", 1)],
)
combined = first_geometry.union(second_geometry)
overlap = first_geometry.intersection(second_geometry)
assert not overlap.is_empty() # The CityObject remains, without geometry.
geometry_extract = model.extract_selection(combined)
merged = merge_models([extracted, geometry_extract])
Selection handles own native resources. They can be used as context managers or closed explicitly when deterministic release is useful in long-running processes.
Links
- Rust workspace and docs: https://github.com/3DGI/cityjson
- CityJSON specification: https://www.cityjson.org
- Issues: https://github.com/3DGI/cityjson/issues
License
Dual-licensed under MIT or Apache-2.0, at your option.
Metadata
Release files for cityjson-lib 0.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cityjson_lib-0.11.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for cityjson_lib-0.11.0-py3-none-win_amd64.whl |
| cityjson_lib-0.11.0-py3-none-manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.28+ x86-64 | Details for cityjson_lib-0.11.0-py3-none-manylinux_2_28_x86_64.whl |
| cityjson_lib-0.11.0-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details for cityjson_lib-0.11.0-py3-none-macosx_11_0_arm64.whl |
Total release size: 13.1 MB
Release files / cityjson_lib-0.11.0-py3-none-win_amd64.whl
| Download URL | cityjson_lib-0.11.0-py3-none-win_amd64.whl |
|---|---|
| Size | 4.0 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b1eeb3f830c2bb01d3630f1b15df3a7c6d9c08e008c43ad370f18cb1f2686b59
|
|
BLAKE2b-256 checksum How to use checksums |
9bb754f1bc0e0f24bdb745f6af94a6e7a00da55b1b1f5828f196c4647f778617
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.
Transparency logRelease files / cityjson_lib-0.11.0-py3-none-manylinux_2_28_x86_64.whl
| Download URL | cityjson_lib-0.11.0-py3-none-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.9 MB |
| Tags | Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
f2c017e553c3b4399937951af39fc4d0c533371697f0a37d2dbaa87d89825404
|
|
BLAKE2b-256 checksum How to use checksums |
93c266ef569f4e22fda3e561344c61cd884ccecb1c9859fe622961e88a62aed9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.
Transparency logRelease files / cityjson_lib-0.11.0-py3-none-macosx_11_0_arm64.whl
| Download URL | cityjson_lib-0.11.0-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 4.2 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
70415d1fb7b3e1c21817a981d964da522c61a0f0f9a5582f7e0c7db769773b92
|
|
BLAKE2b-256 checksum How to use checksums |
ed59a1eff442a3d32c5ce45b9ec133760da14bfedef1407473da60355af60ea2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.
Transparency logSecurity for cityjson-lib 0.11.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 3 files in this release have been uploaded with provenance metadata.
Attestation for cityjson_lib-0.11.0-py3-none-win_amd64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.