Add real building heights for Spain from the Cadastre (Catastro)#1089
Open
pcturnes wants to merge 1 commit into
Open
Add real building heights for Spain from the Cadastre (Catastro)#1089pcturnes wants to merge 1 commit into
pcturnes wants to merge 1 commit into
Conversation
Buildings without a `building:levels`/`height` tag in OSM fall back to a fixed default height. In Spain most OSM buildings lack those tags, so urban areas generate as uniform flat boxes. This adds an optional `--catastro` mode (and a GUI toggle) that fetches the real number of floors per building from the Spanish Cadastre's free INSPIRE Buildings WFS for the generation area, matches each Cadastre BuildingPart to the OSM building it overlaps most, and injects a `building:levels` tag before parsing — so the existing height, roof and window logic applies unchanged. Spain only (excludes the Basque Country and Navarra, which run their own cadastre). Degrades gracefully: outside Spain, or on a service failure, the world is generated with the usual defaults. - New module src/catastro.rs: WFS fetch (tile grid + quadtree fallback), GML parsing via roxmltree, footprint matching via the geo crate - CLI flag --catastro and GUI checkbox "Real heights (Spain / Catastro)" - New dependency: roxmltree Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add real building heights for Spain from the Cadastre (Catastro)
What
Optional feature that replaces the default fallback building height with the
real number of floors from the Spanish Cadastre (Catastro), for buildings in
Spain that have no height in OpenStreetMap.
Why
Arnis derives building height from the OSM
building:levels/heighttags. Whenneither is present it uses a fixed default, so in Spain — where most OSM
buildings lack those tags — urban areas generate as uniform flat boxes.
How
--catastroCLI flag and a GUI toggle "Real heights (Spain / Catastro)"(off by default).
bu:BuildingPartfeatures (numberOfFloorsAboveGround) from theCatastro INSPIRE Buildings WFS (
ovc.catastro.meh.es/INSPIRE/wfsBU.aspx) forthe generation bbox.
(the service caps response size and rejects very large bboxes).
geocrate) and injects abuilding:levelstag into the raw OSM data beforeparsing, so the existing height/roof/window logic is reused unchanged.
roxmltree(GML parsing).Scope / limitations
cadastre and are not served by this WFS.
world is generated with the usual defaults (a warning is printed).
(one height per footprint).
levels → blocksformula.Testing
Verified on central Madrid (Basílica de San Francisco el Grande, ~3 km²):
1311 / 1330 buildings without a prior height enriched (98.6% coverage),
with a realistic floor distribution (peak at 5–6 floors, up to 14). Smaller
areas reach ~100%.
cargo fmtandcargo clippyare clean.Notes
The WFS download adds time proportional to the area (a few minutes for several
km²). A per-area cache would be a natural follow-up.
🤖 Generated with Claude Code