feat(mapset): HotSpot legend + Risico mapset attachment (#919) - #66
Merged
Conversation
Closes #919 (DB half). Adds the 'hotspot' application.mapset_layer row and appends it to the Risico mapset, same shape as add_contractor_tile_layer.sql (#882). A HotSpot is MAX(drystand_risk, dewatering_depth_risk) >= 'd'. No data work is needed - both columns are already in maplayer.building_tiles and in every zoom of maplayer.buildings(z,x,y) - so the layer is entirely a MapLibre filter + paint expression, shipped in FunderMapsWebFront src/config/layers/hotspot.json. Legend reuses the D and E colors of the existing drystand / dewatering legends; order = 0 puts HotSpot above the models it summarizes. Scope on 2026-07-26: 165,286 of 6,449,590 buildings (2.6%) qualify, 8,817 class E and 156,469 class D. Dry-run in a rolled-back transaction on prod: insert + update clean, mapset_collection serves HotSpot first. APPLY ONLY AFTER the WebFront layer config is live - the other order leaves a legend entry WebFront cannot resolve. Co-Authored-By: Claude Opus 5 (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.
Closes Laixer/FunderMaps#919 (DB half). Frontend half: Laixer/FunderMapsWebFront#279.
What
sql/migrate/add_hotspot_layer.sqladds thehotspotrow toapplication.mapset_layerand appends it to the Risico mapset. Same shape asadd_contractor_tile_layer.sql(#882).A HotSpot is a building whose highest risk class across the two groundwater-driven models is D or E:
Why there is no data work
maplayer.building_tilesalready carries bothdrystand_riskanddewatering_depth_risk, andmaplayer.buildings(z,x,y)emits both at every zoom — including the slimmed z12–13 attribute subset. The entire layer is a MapLibre filter + paint expression, shipped in FunderMapsWebFrontsrc/config/layers/hotspot.json. No new column, no tile rebuild, no change to the nightly refresh.So this PR is config only: legend swatches + mapset attachment.
Legend
Reuses the exact D and E colors of the existing
drystand-risk/dewatering-depth-risklegends so HotSpot reads as a summary of those two rather than a separate scale.order = 0puts it at the top of the Risico legend, above the models it summarizes.Verification
Dry-run inside a transaction on prod and rolled back: insert + update both clean, and
application.mapset_collectionserves HotSpot first, ahead ofrestoration-cost(7) throughunclassified-risk(16).Scope today: 165,286 of 6,449,590 buildings (2.6%) qualify — 8,817 class E, 156,469 class D. Top municipalities: Rotterdam 34,746 (21%), Haarlem 12,465, Dordrecht 7,658, Leeuwarden 5,752, Deventer 5,654, Schiedam 5,550.
Apply order
Important
Apply this only after FunderMapsWebFront#279 is live. The other order leaves a layer id in the mapset's
layerSetthat WebFront cannot resolve — dead legend entry plus a console error.🤖 Generated with Claude Code