What You'll Learn
- Import analysis results back into Google Earth Engine
- Filter FeatureCollections based on property values
- Create choropleth maps with custom color palettes
- Compare forecasted vs observed disease incidence visually
- Toggle between multiple data layers for comparison
Building On Previous Learning
This lab continues from Lab 17 where you extracted environmental data. Now you'll visualize the results of disease modeling done in R/EPIDEMIA.
Reference code from Lab 17: View completed Lab 17
Why This Matters
Visualizing forecast results enables:
- Decision support: Health officials can see which areas need resources
- Validation: Compare predictions against actual observations
- Communication: Maps are intuitive for non-technical stakeholders
- Spatial patterns: Identify clusters of high-risk areas
Before You Start
- Prerequisites: Complete Lab 17 - Health Applications Part 1.
- Estimated time: 90 minutes
- Materials: Earth Engine account and understanding of choropleth mapping.
Key Terms
- Choropleth Map
- A thematic map where areas are colored based on a data value, such as disease incidence.
- Incidence Rate
- The number of new disease cases per population (often per 1,000 people) in a time period.
- Forecast Validation
- Comparing predicted values to observed values to assess model accuracy.
- Pilot Woreda
- A district where the forecasting system was actively tested and evaluated.
Background: From Analysis to Visualization
In Lab 17, you exported environmental data from GEE. That data was then used in the EPIDEMIA system - an R package called epidemiar - to forecast malaria incidence. The forecasts were made 8 weeks in advance (from week 24 to predict week 32 of 2018).
Now, these forecast results have been uploaded back to GEE as a FeatureCollection with both:
- inc_n_fc: Forecasted incidence (predicted)
- inc_n_obs: Observed incidence (actual)
Step 1: Import Malaria Data
Start a new script and import the synthetic malaria data:
// Import synthetic malaria data for the Amhara region of Ethiopia
var epidemiaResults = ee.FeatureCollection("users/sounny/amhara_pilot_synthetic_2018W32");
Step 2: Filter Pilot vs Non-Pilot Woredas
Separate woredas with forecast data from those without:
// Filter to only keep woredas WITH forecasted values (pilot areas)
var pilot = epidemiaResults.filter(ee.Filter.neq('inc_n_fc', null));
// Filter to only keep woredas WITHOUT forecasted values (non-pilot areas)
var nonpilot = epidemiaResults.filter(ee.Filter.eq('inc_n_fc', null));
Why filter? Only pilot woredas have forecast data. Non-pilot areas will be displayed in gray to show they weren't part of the study.
Step 3: Define Incidence Categories
The incidence data is categorized into 5 levels (per 1,000 people):
| Category | Incidence Range | Color | Risk Level |
|---|---|---|---|
| 1 | 0 - 0.25 | #fee5d9 | Very Low |
| 2 | 0.25 - 0.5 | #fcae91 | Low |
| 3 | 0.5 - 0.75 | #fb6a4a | Moderate |
| 4 | 0.75 - 1.0 | #de2d26 | High |
| 5 | > 1.0 | #a50f15 | Very High |
Step 4: Create Forecasted Incidence Layer
Paint the pilot woredas based on forecasted incidence:
// Create an empty image for painting
var empty = ee.Image().byte();
// Paint woredas based on forecasted incidence category
var fill_fc = empty.paint({
featureCollection: pilot,
color: 'inc_n_fc'
});
// Define the sequential red color palette
var palette = ['fee5d9', 'fcae91', 'fb6a4a', 'de2d26', 'a50f15'];
// Set map center and add layer
Map.setCenter(38, 11.5, 7);
Map.addLayer(fill_fc, {palette: palette, min: 1, max: 5}, 'Forecasted Incidence');
Step 5: Create Observed Incidence Layer
Add the observed (actual) incidence for comparison:
// Paint woredas based on observed incidence
var fill_obs = empty.paint({
featureCollection: pilot,
color: 'inc_n_obs'
});
// Add layer (hidden by default - toggle visibility to compare)
Map.addLayer(fill_obs, {palette: palette, min: 1, max: 5}, 'Observed Incidence', false);
Try it: Toggle between "Forecasted Incidence" and "Observed Incidence" layers using the Layers panel. How well did the forecast match reality?
Step 6: Add Context Layers
Add non-study areas and boundaries for context:
// Paint non-study woredas with gray
var fill_na = empty.paint({
featureCollection: nonpilot
});
Map.addLayer(fill_na, {palette: 'a1a9a8'}, 'Non-study woredas');
// Draw borders for ALL Amhara region woredas
var outline = empty.paint({
featureCollection: epidemiaResults,
color: 1,
width: 1
});
Map.addLayer(outline, {palette: '000000'}, 'Woredas');
Check Your Understanding
- What is the difference between pilot and non-pilot woredas?
- Why do we use the same color palette for both forecasted and observed incidence?
- What would it mean if a woreda shows category 5 in forecasts but category 2 in observed?
- How could you modify this visualization to show the difference between forecast and observed?
Troubleshooting
Solution: Check that you're using the correct property name ('inc_n_fc' or 'inc_n_obs') and that min/max values match your data range (1-5).
Solution: Ensure you've added both the pilot and nonpilot layers, and check that the FeatureCollection loaded successfully.
Solution: Expand the Layers panel on the right side of the map. The layer order matters - check that layers aren't being hidden by layers added later.
Pro Tips
- Create a legend: Use ui.Panel to add a legend explaining the color categories
- Add difference layer: Calculate forecast - observed to show over/under prediction
- Time animation: With multiple weeks of data, create an animated time series
- Inspector tool: Click on woredas to see exact forecast vs observed values
Key Takeaways
- Analysis results from external tools (R, Python) can be imported back into GEE
- Choropleth maps effectively communicate spatial patterns in health data
- Comparing forecast vs observed layers enables visual model validation
- Consistent color scales are essential for fair comparisons
📋 Lab Submission
Subject: Lab 18 - Health Applications Part 2 - [Your Name]
Submit:
A shareable URL to your GEE script that shows:
- Forecasted incidence choropleth layer
- Observed incidence choropleth layer (can be hidden by default)
- Non-study woredas in gray
- Woreda boundaries
- Comments explaining each section