WFP-VAM / prism-app

PRISM is an interactive map-based dashboard that simplifies the integration of geospatial data on hazards, along with information on socioeconomic vulnerability
MIT License
45 stars 33 forks source link

[Feature Request]: Use thresholds in layer legend for analysis results #1173

Closed wadhwamatic closed 1 week ago

wadhwamatic commented 3 months ago

Provide a clear and concise description of what you want to happen.

When an analysis is run, PRISM automatically categorizes the results as Very Low, Low, Medium, High or Very High and visualizes them in shades of red. However, we already have categories and a color scheme defined in the hazard layer's configuration that are not being used here.

This request is to use the configuration of the hazard layer that was analyzed for categorization and visualization. For example, if a user runs an analysis of 10-day rainfall estimate (rainfall_dekad), instead of assigning each admin area Very Low to Very High, we can use the thresholds in the legend. In this example, rainfall_dekad uses the legend rfh_16_0_300 in shared/legends.json (see below) which can be applied to the statistic that was analyzed.

  "rfh_16_0_300": [
    {"value": 0, "label": "0 mm", "color": "#fafafa"},
    {"value": 0.01, "label": "1-2 mm", "color": "#fffadf"},
    {"value": 2, "label": "2-5 mm", "color": "#d3f9d0"},
    {"value": 5, "label": "5-10 mm", "color": "#a9e4a3"},
    {"value": 10, "label": "10-20 mm", "color": "#7cc594"},
    {"value": 20, "label": "20-30 mm", "color": "#5eab91"},
    {"value": 30, "label": "30-40 mm", "color": "#9fffe8"},
    {"value": 40, "label": "40-50 mm", "color": "#90e0ef"},
    {"value": 50, "label": "50-60 mm", "color": "#00b1de"},
    {"value": 60, "label": "60-80 mm", "color": "#0083f3"},
    {"value": 80, "label": "80-100 mm", "color": "#0052cd"},
    {"value": 100, "label": "100-120 mm", "color": "#0000c8"},
    {"value": 120, "label": "120-150 mm", "color": "#6003b8"},
    {"value": 150, "label": "150-200 mm", "color": "#a002fa"},
    {"value": 200, "label": "200-300 mm", "color": "#fa78fa"},
    {"value": 300, "label": ">= 300 mm", "color": "#ffc4ee"}
  ],

Is there anything else you can add about the proposal? You might want to link to related issues here, if you haven't already.

There are three additional issues to consider with this change:

  1. If the hazard layer was already loaded, we might want to hide the raster (png tiles) version of the layer and just show the analysis results
  2. In the future, we might want to give user's the option to categorize results based on x buckets. This needs some more thinking and validation of the need though
  3. As @ericboucher mentioned in the comment in this issue, this new approach won't apply when we run an area / population exposure analysis.
ericboucher commented 1 month ago

Just a quick note that this would not apply to "area exposed". For area exposed we can keep the same behavior, or we can decide on fixed buckets. cc @wadhwamatic

gislawill commented 1 month ago

Note to future Will: See this example of the issue in screenshot.

Screenshot 2024-06-18 at 2 46 30 PM