Skip to content

fix: serve and link buildings extracted at LOD3 - #147

Merged
jravani merged 3 commits into
mainfrom
fix/serve-lod3
Sep 29, 2026
Merged

jravani merged 3 commits into
mainfrom
fix/serve-lod3

Conversation

@jravani

@jravani jravani commented Sep 29, 2026

Copy link
Copy Markdown
Member

Extraction writes LOD3 input to lod3_building and lod3_surface, but nothing read those tables: the on-request queries were built on the lod2_ prefix only, and -link-pylovo batched only LOD2 buildings. A database built from LOD3 data served no buildings and linked none, without an error.

  • internal/onrequest/query.go: the five queries read lod2_ and lod3_ together through UNION ALL. Both tables come from sql/schema/main/01_create_main_tables.sql, so the columns match. No new setting.
  • -link-pylovo runs one pass per LOD schema, because building_feature_id is only unique within one schema. The link SQL already reads {lod_schema}; each task now carries the LOD it batches. BUILDING_LIMIT spans both passes.
  • A database holding both LOD2 and LOD3 of the same area returns those buildings twice.

Verified

  • New TestServer_ReadsLOD3Buildings and TestRunPyLovoLinkBuild_LinksLOD3Buildings fail before the change (no buildings returned; no building_link row) and pass after. TestPyLovoLinkJobQueue_WithBatches now asserts the LOD each task carries.
  • go vet ./..., go test ./... and the internal/process, internal/onrequest and internal/api integration suites pass.
  • On a database extracted from a Prague LOD3 CityGML file (6,766 buildings, EPSG:5514), GET /api/v1/buildings for a 300 m box returns 331 buildings with 3,340 surfaces, where the current server returns none.

Release

Also cherry-picked onto release/v0.7.x and tagged v0.7.2. No schema change.

Extraction writes LOD3 input to lod3_building and lod3_surface, but the
on-request queries read only the lod2_ tables and -link-pylovo batched
only LOD2 buildings. A database built from LOD3 data, such as Prague's
CityGML, therefore served no buildings and linked none.

The five on-request queries now read the lod2_ and lod3_ tables together
through UNION ALL; both come from the same DDL, so their columns match.
-link-pylovo runs one pass per LOD schema, since building_feature_id is
only unique within one schema, and the building limit spans both passes.
A database holding both levels of one area returns those buildings
twice.
@codecov

codecov Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.00000% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/process/feature_extraction.go 55.55% 8 Missing and 4 partials ⚠️

📢 Thoughts on this report? Let us know!

v0.7.2 read the lod2_ and lod3_ tables with SELECT * under UNION ALL,
which assumes both have the same columns. A database built by an
earlier release does not: area_below_precision was added to
lod2_surface alone, and neither surface table has length or width. On
such a database every buildings and geometry call failed with "each
UNION query must have the same number of columns".

The union now reads a named column list that every release's tables
carry. area_below_precision is derived in the query with the same
definition script 08 stores, so a table without the column still
serves.
TestServer_ServesOlderReleaseSchema drops the surface columns an older
release lacked. length and width exist only from the length/width
change onward, so a branch without them failed the ALTER before the
test reached the queries it checks.
@jravani
jravani merged commit 8e0caf0 into main Sep 29, 2026
3 of 4 checks passed
@jravani
jravani deleted the fix/serve-lod3 branch September 30, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant