Skip to content

feat(osm-equity): selectable heat-map metric + grey N/A shading#30

Merged
rlemke merged 1 commit into
mainfrom
feat/osm-equity-map-metric
Jul 14, 2026
Merged

feat(osm-equity): selectable heat-map metric + grey N/A shading#30
rlemke merged 1 commit into
mainfrom
feat/osm-equity-map-metric

Conversation

@rlemke

@rlemke rlemke commented Jul 14, 2026

Copy link
Copy Markdown
Owner

render_maplibre_map gains metric/metric_label params (default attr_completeness) so maps can colour by any per-unit metric — e.g. footprint_completeness for the OSM-vs-authoritative building gap. Negative N/A sentinels render grey (MapLibre case) instead of worst-colour. Default behaviour unchanged; 16 offline tests pass; ruff clean.

Used for a full-detail tiled Tucson map (real OSM 282k buildings vs 252k MS footprints): 21/167 tiles below 50% OSM building completeness.

🤖 Generated with Claude Code

render_maplibre_map gains metric/metric_label params (default
attr_completeness), so a map can colour units by any per-unit metric — e.g.
footprint_completeness to show the OSM-vs-authoritative building gap. Negative
sentinels (N/A, e.g. no footprint reference) now render grey via a MapLibre
`case` rather than as the worst colour. Default behaviour unchanged.

Used to render a full-detail tiled Tucson map (real OSM 282k buildings vs
252k Microsoft footprints): 21/167 2-sq-mi tiles fall below 50% OSM building
completeness — intra-city under-mapping the national aggregate hides.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rlemke rlemke merged commit 6231152 into main Jul 14, 2026
@rlemke rlemke deleted the feat/osm-equity-map-metric branch July 14, 2026 02:29

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates render_maplibre_map to support dynamic metrics and labels, and introduces a grey fallback color for negative metric values. The review feedback points out a potential runtime rendering error in MapLibre GL JS if the metric property is missing or null, and suggests providing a fallback value of -1 to the to-number expression to ensure robust rendering.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +794 to +796
'fill-color':['case',['<',['to-number',['get','{metric}']],0],'#999999',
['interpolate',['linear'],['to-number',['get','{metric}']],
0.0,'#d73027',0.25,'#fc8d59',0.5,'#fee08b',0.75,'#91cf60',1.0,'#1a9850']],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In MapLibre GL JS, the interpolate expression strictly requires a numeric input. If the property specified by {metric} is missing or null on any feature, ['to-number', ['get', '{metric}']] will return null. Comparing null < 0 will evaluate to false, causing the expression to fall through to the interpolate block with a null input, which triggers a runtime rendering error in MapLibre.

To prevent this and ensure robust rendering, provide a fallback value (such as -1) to the to-number expression. This way, any missing or invalid values will safely default to -1, match the < 0 condition, and render as grey (#999999).

Suggested change
'fill-color':['case',['<',['to-number',['get','{metric}']],0],'#999999',
['interpolate',['linear'],['to-number',['get','{metric}']],
0.0,'#d73027',0.25,'#fc8d59',0.5,'#fee08b',0.75,'#91cf60',1.0,'#1a9850']],
'fill-color':['case',['<',['to-number',['get','{metric}'],-1],0],'#999999',
['interpolate',['linear'],['to-number',['get','{metric}'],-1],
0.0,'#d73027',0.25,'#fc8d59',0.5,'#fee08b',0.75,'#91cf60',1.0,'#1a9850']],

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