Skip to content

feat(mapset): HotSpot legend + Risico mapset attachment (#919) - #66

Merged
yorickdewid merged 1 commit into
mainfrom
feat/hotspot-layer
Jul 26, 2026
Merged

feat(mapset): HotSpot legend + Risico mapset attachment (#919)#66
yorickdewid merged 1 commit into
mainfrom
feat/hotspot-layer

Conversation

@yorickdewid

Copy link
Copy Markdown
Contributor

Closes Laixer/FunderMaps#919 (DB half). Frontend half: Laixer/FunderMapsWebFront#279.

What

sql/migrate/add_hotspot_layer.sql adds the hotspot row to application.mapset_layer and appends it to the Risico mapset. Same shape as add_contractor_tile_layer.sql (#882).

A HotSpot is a building whose highest risk class across the two groundwater-driven models is D or E:

MAX(drystand_risk, dewatering_depth_risk) >= 'd'

Why there is no data work

maplayer.building_tiles already carries both drystand_risk and dewatering_depth_risk, and maplayer.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 FunderMapsWebFront src/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-risk legends so HotSpot reads as a summary of those two rather than a separate scale. order = 0 puts 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_collection serves HotSpot first, ahead of restoration-cost (7) through unclassified-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 layerSet that WebFront cannot resolve — dead legend entry plus a console error.

🤖 Generated with Claude Code

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>
@yorickdewid
yorickdewid merged commit 546dde0 into main Jul 26, 2026
1 check passed
@yorickdewid
yorickdewid deleted the feat/hotspot-layer branch July 26, 2026 21:23
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.

HotSpot kaart

2 participants