garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

.. /docs/adr/027-3dbag-buildings.md

raw

ADR-027: Self-Hosted 3DBAG Buildings for Covered Areas


Metadata:


Context

Problem: OSM 3D buildings (ADR-022) carry sparse, guessed heights — most Dutch footprints have no height/building:levels, so we estimate from type. The Netherlands has an authoritative open dataset, 3DBAG (TU Delft, from Kadaster BAG + AHN LiDAR), with real per-building heights and ground level. Its live API is slow, and downloading + parsing 3D CityJSON on the client is heavy.

Requirements:

Decision

Preprocess 3DBAG server-side, self-host it as static per-cell files, and route covered cells to it — OSM elsewhere. Two tiers, both keyed on the client's CACHE_ZOOM=14 cells and served from https://3dbag.cartopolis.org/:

Approach:

Rationale

Primary Reasoning:

  1. Because the server emits the client's Overpass shape, parse_buildings and the whole extrude/window/far-cell pipeline (ADR-022) are reused verbatim — the only client change is where a cell is fetched. No CityJSON, no CRS math, no mesh loader on the client.
  2. All NL-specific complexity (WFS paging, RD→WGS84, LoD1.2 height model) lives server-side and runs once per data release, mirroring the self-hosted Overpass/Nominatim precedent (ADR-014, server.md). The client stays in lat/lng + metres, so the floating-origin frame (ADR-019) is untouched.
  3. Static hosting is far lighter than the live API or a database: 3DBAG is download-once (≈yearly releases). Groningen is ~90k buildings / 44 MB.

Alternatives Considered:

AlternativeProsConsRejected Because
Client fetches the live 3DBAG APINo hostingSlow; CityJSON + RD parsing on clientLatency and client weight are the whole problem
Ship LoD2.2 meshes (real roofs) as 3D Tiles/glTFTrue roof geometryNew client mesh/3D-Tiles path; bigger dataLarger change; LoD1.2 heights are the high-value first win — LoD2.2 is a fast follow
Bake 3DBAG into the sim world DBServer-authoritativeImport pipeline + schema before need; NL-only in a global schemaPremature; static files match the OSM-cell pattern already in use
New client building schema (not Overpass-shaped)Cleaner wire formatNew client parser + a second rendering pathReusing the Overpass shape makes the client change ~routing only

Consequences

Positive:

Negative / risks:

Related