bimfabrikhh_core_rs
A Rust library with Python bindings: parse CityGML 1.0 / 2.0 and CityJSON 1.1 and write IFC4 STEP.
About This Project
bimfabrikhh_core_rs is developed and maintained by Freie und Hansestadt Hamburg, Landesbetrieb Geoinformation und Vermessung (LGV), BIM-Leitstelle
This library is part of BIMFabrikHH. The core is implemented in Rust; Python bindings expose the conversion API. It converts urban building models to IFC4 STEP.
This project is in an early stage of development. The API and features will keep evolving.
Author: Ahmed Salem (BIM-Leitstelle, LGV Hamburg)
Quick Install
pip install bimfabrikhh_core_rs
Optional pydantic helpers for property-set specs, IFC type maps, and owner identity:
pip install "bimfabrikhh_core_rs[psets]"
Wheels are published for Linux x86_64, Windows x64, and macOS Apple Silicon. One wheel per platform works for Python 3.11+.
Overview
The conversion API has no Python runtime dependencies and does not use ifcopenshell. Geometry is parsed and written in
Rust. You fetch the data; the package converts it. There is no HTTP inside the library.
- CityGML 1.0 / 2.0 and CityJSON 1.1 → one IFC4 STEP file
mode="typed"— one product per semantic surface (IfcWall,IfcRoof,IfcSlab, …)mode="mesh"— oneIfcBuildingElementProxyper building- Property sets, colours, CAD layer, and owner history are opt-in
- Coordinates stay in the CRS they arrive in;
epsgonly tags the file
Public API
Conversion
gml_to_ifc(path, ifc_path, ...)— CityGML file or list of files → IFCcityjson_to_ifc(source, ifc_path, ...)— CityJSON path, list of paths, or document text → IFCwrite_ifc(products, path, ...)— IFC from product dicts you built yourselftrees_to_ifc(trees, ifc_path, ...)— trunk + crown meshes → IFC (TreesGenericApp path). Optionaldrape_vertices/drape_facessetsz = 0from the DGM triangle (else nearest vertex).terrain_to_ifc(vertices, faces, ifc_path, ...)— triangulated DGM → IFC (TerrainGenericApp write path)
Parse
parse_gml(path, ...)— CityGML → list of building dictsparse_cityjson(path, ...)— CityJSON file → building dictsparse_cityjson_text(text, ...)— CityJSON already in memory (after HTTP)
Optional helpers (bimfabrikhh_core_rs[psets])
PsetSpec/Attr/Const/Quantity— declarative property-set ruleshamburg_defaults()/attribute_mapping.specs()/tree_mapping.specs()/terrain_mapping.specs()— Hamburg property nameshamburg_ifc_types()/IfcTypeMap— surface type → IFC entityOwnerIdentity/owner.defaults()— FILE_NAME +IfcPerson/IfcOrganization/IfcApplication
Key Features
- No HTTP — fetch tiles yourself; pass paths or CityJSON text
- Typed or mesh — per-surface products or one block per building
- Declarative psets — omit
psets=and none are written - Deterministic GUIDs — the same input produces a byte-identical IFC
- Hamburg-ready — optional type map, property mapping,
_BIM_Stadtmodelllayer, and Nullpunkt
Complete Working Example
from bimfabrikhh_core_rs import cityjson_to_ifc, gml_to_ifc, parse_cityjson_text
# CityGML tile → typed IFC (IfcWall / IfcRoof / IfcSlab per surface)
gml_to_ifc("tile.gml", "out.ifc", mode="typed", epsg=25833)
# CityJSON → one IfcBuildingElementProxy mesh per building
cityjson_to_ifc("page.city.json", "blocks.ifc", mode="mesh", epsg=25832)
# Inspect before writing
buildings = parse_cityjson_text(open("page.city.json").read())
print(len(buildings), buildings[0]["gml_name"])
Crop, colours, and Hamburg types:
from bimfabrikhh_core_rs import cityjson_to_ifc
from bimfabrikhh_core_rs.attribute_mapping import specs
from bimfabrikhh_core_rs.ifc_types import hamburg_ifc_types
cityjson_to_ifc(
"page.city.json",
"hamburg.ifc",
mode="typed",
epsg=25832,
bbox_epsg=(565012.0, 5933559.0, 566570.0, 5934571.0),
basepoint=(565012.0, 5933559.0),
ifc_types=hamburg_ifc_types(),
psets=specs(),
cad_layer=True,
)
mode is "typed" or "mesh". Omit ifc_types and every product is IfcBuildingElementProxy. Omit psets and the
IFC has no property sets. bbox_epsg is (min_x, min_y, max_x, max_y) in the projected CRS. Reprojection is out of
scope — use pyproj on the caller side if you need to transform.
Trees (same look as BIMFabrik TreesGenericApp; Python still prepares records):
from bimfabrikhh_core_rs import trees_to_ifc
from bimfabrikhh_core_rs.tree_mapping import specs
trees_to_ifc(
[
{
"name": "Baum_001",
"position": (565100.0, 5933600.0, 0.0),
"trunk_radius": 0.3,
"trunk_height": 4.0,
"crown_radius": 2.5,
"detail": 1,
"segments": 8,
"attributes": {"baumnummer": "001", "gattung_deutsch": "Eiche", "art_baum": "Quercus robur"},
}
],
"trees.ifc",
epsg=25832,
psets=specs(),
basepoint=(565100.0, 5933600.0),
# drape_vertices=mesh.vertices, # optional: lift z=0 from nearest DGM sample
)
Terrain (Python still samples / Delaunay; Rust only writes IFC):
from bimfabrikhh_core_rs import terrain_to_ifc
from bimfabrikhh_core_rs.terrain_mapping import specs
terrain_to_ifc(vertices, faces, "dgm.ifc", epsg=25832, psets=specs(), basepoint=(565000.0, 5933000.0))
Property sets
Pass psets= a list of specs describing rules rather than values. The spec is validated once and evaluated in Rust for
every building and surface.
from bimfabrikhh_core_rs import cityjson_to_ifc
from bimfabrikhh_core_rs.psets import Attr, Const, PsetSpec, Quantity
building = PsetSpec(
name="Pset_Objektinformation",
scope="building",
properties={
"_IDEbene1": Const("Stadtmodell"),
"_StadtmodellLoD": Attr("lod"),
"_Dachform": Attr("roof_type", catalog="dachform"),
"_GrundhoeheNN": Attr("extra:Grundhöhe NN"),
},
)
surface = PsetSpec(
name="BIMFabrikHH_Quantities",
scope="surface",
properties={
"GrossArea": Quantity("area", decimals=4),
"SurfaceType": Quantity("surface_type"),
},
)
cityjson_to_ifc("page.city.json", "out.ifc", epsg=25832, psets=[building, surface])
| Value | Reads |
|---|---|
Const(value) |
a fixed string |
Attr(key, catalog=…, decimals=…, default=…) |
a building field (id, gml_name, lod, function, measured_height, storeys_above_ground, roof_type, or extra:<name>) |
Quantity(key, decimals=…) |
surface geometry (area, perimeter, tilt, surface_type) |
A missing source field omits that property. A plain dict works without pydantic.
Other options
from bimfabrikhh_core_rs import cityjson_to_ifc
from bimfabrikhh_core_rs.ifc_types import IfcTypeMap
from bimfabrikhh_core_rs.owner import defaults
cityjson_to_ifc(
"page.city.json",
"out.ifc",
epsg=25832,
ifc_types=IfcTypeMap(RoofSurface="IfcRoof", WallSurface="IfcWall"),
colors={"RoofSurface": (1.0, 0.0, 0.0)},
owner=defaults(),
)
Default colours match BIMFabrikHH: roofs red, everything else yellow. styles=False writes no colour. Owner history
defaults to Ahmed Salem / BIM-Leitstelle, LGV Hamburg; owner_history=False skips it.
Examples
Additional examples are available in the GitHub repository.
Links
- PyPI: https://pypi.org/project/bimfabrikhh-core-rs/
- GitHub: https://github.com/LGV-BIM-Leitstelle/bimfabrikhh_core_rs
- Issues: https://github.com/LGV-BIM-Leitstelle/bimfabrikhh_core_rs/issues
License
This project is licensed under the GNU Lesser General Public License v2.1 (LGPL-2.1).
Copyright (C) 2026 Freie und Hansestadt Hamburg, Landesbetrieb Geoinformation und Vermessung BIM-Leitstelle, Ahmed Salem
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bimfabrikhh_core_rs-0.1.1.tar.gz.
File metadata
- Download URL: bimfabrikhh_core_rs-0.1.1.tar.gz
- Upload date:
- Size: 103.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a57cf345d638d73adbde1d56191479a53ca882ec5f329269f5daf9892f56bc7
|
|
| MD5 |
7ab049ab65ae02a601917a6f6f476122
|
|
| BLAKE2b-256 |
c3e73637b1c3e579fb6f1cd62da3a58870db6e437f67d9feadfb9e527a7f28e8
|
Provenance
The following attestation bundles were made for bimfabrikhh_core_rs-0.1.1.tar.gz:
Publisher:
ci-bimfabrikhh-core-rs-pypi.yaml on LGV-BIM-Leitstelle/bimfabrikhh_core_rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bimfabrikhh_core_rs-0.1.1.tar.gz -
Subject digest:
3a57cf345d638d73adbde1d56191479a53ca882ec5f329269f5daf9892f56bc7 - Sigstore transparency entry: 2654077844
- Sigstore integration time:
-
Permalink:
LGV-BIM-Leitstelle/bimfabrikhh_core_rs@3a22733cc2202d40e140a8f252743ea9e492181e -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/LGV-BIM-Leitstelle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-bimfabrikhh-core-rs-pypi.yaml@3a22733cc2202d40e140a8f252743ea9e492181e -
Trigger Event:
release
-
Statement type:
File details
Details for the file bimfabrikhh_core_rs-0.1.1-cp311-abi3-win_amd64.whl.
File metadata
- Download URL: bimfabrikhh_core_rs-0.1.1-cp311-abi3-win_amd64.whl
- Upload date:
- Size: 531.9 kB
- Tags: CPython 3.11+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
273ca4c5f7e1349112c01f877445af6bd50d79d88e79365619950158678951ed
|
|
| MD5 |
6601629c5fc998c2bfcae80a19eb1b7a
|
|
| BLAKE2b-256 |
a7d5e2b1b706b867f44f581d24e5a45ba8a1acdae95d60f0aa111261a29a9601
|
Provenance
The following attestation bundles were made for bimfabrikhh_core_rs-0.1.1-cp311-abi3-win_amd64.whl:
Publisher:
ci-bimfabrikhh-core-rs-pypi.yaml on LGV-BIM-Leitstelle/bimfabrikhh_core_rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bimfabrikhh_core_rs-0.1.1-cp311-abi3-win_amd64.whl -
Subject digest:
273ca4c5f7e1349112c01f877445af6bd50d79d88e79365619950158678951ed - Sigstore transparency entry: 2654078138
- Sigstore integration time:
-
Permalink:
LGV-BIM-Leitstelle/bimfabrikhh_core_rs@3a22733cc2202d40e140a8f252743ea9e492181e -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/LGV-BIM-Leitstelle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-bimfabrikhh-core-rs-pypi.yaml@3a22733cc2202d40e140a8f252743ea9e492181e -
Trigger Event:
release
-
Statement type:
File details
Details for the file bimfabrikhh_core_rs-0.1.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: bimfabrikhh_core_rs-0.1.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 698.2 kB
- Tags: CPython 3.11+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6696161a547c7f8410dc1949741c4a81513704dc0b773182c6075b9452ca09d2
|
|
| MD5 |
9eccd073ade25317f371c83c78786663
|
|
| BLAKE2b-256 |
419bec9eba9672cfa80b339c99190a74c196994a524d8a907403c967bdb18637
|
Provenance
The following attestation bundles were made for bimfabrikhh_core_rs-0.1.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
ci-bimfabrikhh-core-rs-pypi.yaml on LGV-BIM-Leitstelle/bimfabrikhh_core_rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bimfabrikhh_core_rs-0.1.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
6696161a547c7f8410dc1949741c4a81513704dc0b773182c6075b9452ca09d2 - Sigstore transparency entry: 2654078043
- Sigstore integration time:
-
Permalink:
LGV-BIM-Leitstelle/bimfabrikhh_core_rs@3a22733cc2202d40e140a8f252743ea9e492181e -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/LGV-BIM-Leitstelle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-bimfabrikhh-core-rs-pypi.yaml@3a22733cc2202d40e140a8f252743ea9e492181e -
Trigger Event:
release
-
Statement type:
File details
Details for the file bimfabrikhh_core_rs-0.1.1-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: bimfabrikhh_core_rs-0.1.1-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 646.3 kB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7104d3519c97abe353fc7752ce600424f14c0385cc9e35c2711d46ec578d4b9
|
|
| MD5 |
502424400e6006c7c88db0dfbff5e73d
|
|
| BLAKE2b-256 |
03d6bbd7d942452ec037f0db2d9c5a7d6f3c20a981513c9f20f9f3021c6017c4
|
Provenance
The following attestation bundles were made for bimfabrikhh_core_rs-0.1.1-cp311-abi3-macosx_11_0_arm64.whl:
Publisher:
ci-bimfabrikhh-core-rs-pypi.yaml on LGV-BIM-Leitstelle/bimfabrikhh_core_rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bimfabrikhh_core_rs-0.1.1-cp311-abi3-macosx_11_0_arm64.whl -
Subject digest:
b7104d3519c97abe353fc7752ce600424f14c0385cc9e35c2711d46ec578d4b9 - Sigstore transparency entry: 2654077939
- Sigstore integration time:
-
Permalink:
LGV-BIM-Leitstelle/bimfabrikhh_core_rs@3a22733cc2202d40e140a8f252743ea9e492181e -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/LGV-BIM-Leitstelle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-bimfabrikhh-core-rs-pypi.yaml@3a22733cc2202d40e140a8f252743ea9e492181e -
Trigger Event:
release
-
Statement type: