diff --git a/examples/osm-equity/handlers/shared/equity_utils.py b/examples/osm-equity/handlers/shared/equity_utils.py index 65d67db9..757d3374 100644 --- a/examples/osm-equity/handlers/shared/equity_utils.py +++ b/examples/osm-equity/handlers/shared/equity_utils.py @@ -708,12 +708,20 @@ def data_deserts(records: list[dict]) -> list[str]: def render_maplibre_map( - feats: list[dict], title: str, stats_res: dict, deserts: list[str], synthetic: bool = True + feats: list[dict], + title: str, + stats_res: dict, + deserts: list[str], + synthetic: bool = True, + metric: str = "attr_completeness", + metric_label: str = "Attribute completeness", ) -> str: - """Self-contained MapLibre GL choropleth ("heat map") of tract OSM - attribute completeness, styled to match the facetwork-maps gallery: - inline GeoJSON, CARTO Voyager raster basemap, click popups, a legend, - and a findings banner. Data-desert tracts get a red outline.""" + """Self-contained MapLibre GL choropleth ("heat map") of a per-unit OSM + metric (default attribute completeness), styled to match the facetwork-maps + gallery: inline GeoJSON, CARTO Voyager raster basemap, click popups, a + legend, and a findings banner. Data-desert units get a red outline. + Negative metric values (N/A sentinels, e.g. no footprint reference) render + grey rather than as the worst colour.""" fc = json.dumps({"type": "FeatureCollection", "features": feats}) # total bounds via shapely (handles Polygon + MultiPolygon uniformly) xmin = ymin = float("inf") @@ -764,7 +772,7 @@ def render_maplibre_map(