Practical Course 32

Global Spatial Epidemiology: GeoAI Machine Learning for Environmental Disease Risk Mapping

Learn how to integrate satellite-derived climate variables, vegetation dynamics, and population data using Earth Engine to map vector-borne disease transmission envelopes.
Global ~2 hours Advanced
Dataset: ECMWF/ERA5_LAND/MONTHLY_AGGR ERA5-Land Monthly Aggregated Atmospheric Variables

📖 Key Terms for Beginners

Before starting, make sure you understand these terms. They appear throughout all code blocks in this course.

TermFull NameWhat it means in simple words
Spatial EpidemiologySpatial EpidemiologyThe study of spatial patterns in disease distribution and their relationship with environmental risk factors.
Environmental ExposureEnvironmental ExposureThe presence of physical or climatic conditions that facilitate pathogen transmission or vector survival.
Ecological Niche ModelingEcological Niche ModelingGeoAI techniques used to predict the spatial distribution of vector species based on environmental variables.
Spatial AutocorrelationSpatial AutocorrelationThe tendency for geographical locations close to one another to exhibit more similar health outcomes than distant points.
Moran's IMoran's I StatisticA statistical index used to quantify spatial autocorrelation and cluster intensity in epidemiological data.
Random ForestRandom Forest ClassifierAn ensemble machine learning method that trains multiple decision trees for spatial prediction and classification.
MAUPModifiable Areal Unit ProblemStatistical bias introduced when spatial point observations are aggregated into administrative boundaries.
Confounding VariableConfounding VariableAn unmeasured factor that correlates with both the environmental predictor and the health outcome, potentially distorting causal conclusions.
Geographic Re-identificationGeographic Re-identification RiskThe privacy vulnerability of linking spatial health data to personal identity using fine-grained coordinates.
Vector Transmission EnvelopeVector Transmission Climate EnvelopeThe specific range of temperature, humidity, and rainfall required for pathogen vectors to survive and reproduce.
Population Exposure MaskingPopulation Exposure MaskingOverlapping predicted environmental risk grids with population count datasets to quantify affected communities.
Relative Risk RatioRelative Risk RatioA ratio comparing disease probability in exposed spatial units relative to unexposed reference zones.

Contents

  1. 1. Introduction to GeoAI in Public Health and Spatial Epidemiology
  2. 2. Defining Environmental Determinants of Climate-Sensitive Vector Diseases
  3. 3. Multi-Sensor Data Harmonization in Google Earth Engine
  4. 4. Spatial Autocorrelation and Sampling Strategy Design
  5. 5. Feature Engineering: Temperature, Precipitation, and NDVI Extraction
  6. 6. Training a Random Forest Ecological Niche Classifier
  7. 7. Predict Disease Vector Transmission Suitability Grids
  8. 8. Population Exposure Integration using WorldPop
  9. 9. Aggregating Risk and Addressing MAUP in Health Reporting
  10. 10. Ethics, Geographic Privacy Protection, and Model Export
1
Introduction
10 min

Climate-sensitive vector-borne diseases pose a critical global public health threat under accelerating environmental change. This advanced course demonstrates how to leverage Earth Observation datasets and GeoAI machine learning inside Google Earth Engine to model environmental suitability and human exposure. Students will harmonize ERA5-Land climate reanalysis, MODIS vegetation indices, and WorldPop population grids to build predictive spatial models while rigorously accounting for spatial autocorrelation, causal limits, and patient privacy.

GEE Asset ID
ECMWF/ERA5_LAND/MONTHLY_AGGR
Dataset Name
ERA5-Land Monthly Aggregated Atmospheric Variables
Study Area
Global
AI Tool
DeepSeek (free, no API key needed)
🌍
What you will build: By the end of this course you will have a working GEE script that analyzes Global Spatial Epidemiology: GeoAI Machine Learning for Environmental Disease Risk Mapping, computes statistics, visualizes results on an interactive map, and exports data to Google Drive.

2
Setup: GEE + DeepSeek
5 min

You need two browser tabs open side by side throughout this course.

1
Open chat.deepseek.com -- free account, no API key needed
2
Open code.earthengine.google.com in a second tab
3
Create a new GEE script named Course32_Global Spatial Epidemiology: GeoAI Machine Learning for Environmental Disease Risk Mapping
💡
Workflow: Write a prompt in DeepSeek describing your task with exact dataset IDs and requirements. Copy the generated GEE JavaScript. Paste into GEE code editor. Click Run. Inspect results. Iterate.

3
Crafting the DeepSeek Prompt
15 min

The prompt is the core skill of this course. A good prompt includes the exact dataset ID, band names, study area coordinates, dates, preprocessing steps, and desired outputs.

📋 Main Prompt -- copy and paste this into DeepSeek
Write a complete, executable Google Earth Engine (GEE) JavaScript script for modeling vector-borne disease risk at a regional scale. Use ECMWF/ERA5_LAND/MONTHLY_AGGR for air temperature ('temperature_2m_mean') and precipitation ('total_precipitation_sum'), MODIS/061/MOD13A2 for vegetation greenness ('NDVI'), and WORLDPOP/GP/100m/pop for human population counts. Define sample training points representing vector presence (1) and absence (0) across environmental gradients. Train an ee.Classifier.smileRandomForest model on these features to predict transmission suitability. Mask the output with population data to calculate total exposed population. Avoid fake GEE functions, ensure valid band names, format visual layers with clear color palettes, and write export code using Export.image.toDrive(). Explain spatial autocorrelation and privacy limitations in comments.
✨
After pasting the prompt: Wait 20-30 seconds for DeepSeek to generate the full GEE script. Copy the entire code block it produces. If the output is cut short, type "Continue the code" to get the rest.

4
Multi-Source Data Loading, Harmonization, and Feature Generation
10 min

Paste the following code into your GEE code editor and click Run. Read the beginner notes below to understand what each line does.

Multi-Source Data Loading, Harmonization, and Feature Generation
// Define study bounding box for sample regional analysis
var roi = ee.Geometry.Polygon([[
  [-82.0, -18.0], [-82.0, 12.0], [-34.0, 12.0], [-34.0, -18.0]
]], null, false);

// Filter ERA5-Land Monthly Climate Data for 2022
var era5 = ee.ImageCollection('ECMWF/ERA5_LAND/MONTHLY_AGGR')
  .filterDate('2022-01-01', '2022-12-31')
  .filterBounds(roi);

// Calculate mean temperature (convert Kelvin to Celsius) and total annual precipitation
var meanTemp = era5.select('temperature_2m_mean')
  .mean()
  .subtract(273.15)
  .rename('mean_temp_c');

var totalPrecip = era5.select('total_precipitation_sum')
  .sum()
  .multiply(1000)
  .rename('total_precip_mm');

// Load MODIS 16-Day NDVI for 2022 and compute annual mean
var modisNdvi = ee.ImageCollection('MODIS/061/MOD13A2')
  .filterDate('2022-01-01', '2022-12-31')
  .select('NDVI')
  .mean()
  .multiply(0.0001)
  .rename('mean_ndvi');

// Load WorldPop 2020 Global Population Grid
var population = ee.ImageCollection('WORLDPOP/GP/100m/pop')
  .filterDate('2020-01-01', '2020-12-31')
  .mosaic()
  .rename('population_count');

// Concatenate environmental predictor variables into a single multi-band image
var predictors = ee.Image.cat([meanTemp, totalPrecip, modisNdvi]).clip(roi);

// Set Map visualization settings
Map.centerObject(roi, 4);
Map.addLayer(meanTemp, {min: 15, max: 35, palette: ['blue', 'yellow', 'red']}, 'Mean Temp (C)');
Map.addLayer(totalPrecip, {min: 0, max: 3000, palette: ['white', 'blue', 'darkblue']}, 'Precipitation (mm)');
Map.addLayer(modisNdvi, {min: 0, max: 0.8, palette: ['brown', 'yellow', 'green']}, 'Mean NDVI');
🔑
Beginner note: This block harmonizes atmospheric parameters from ERA5-Land, vegetation dynamics from MODIS, and demographic data from WorldPop over a tropical study area. Temperature is converted from Kelvin to Celsius and precipitation is accumulated to annual totals. All predictor bands are stacked into a multi-band image layer ready for spatial model training.

5
GeoAI Random Forest Classifier and Population Exposure Analysis
10 min

Add this block after the previous code. It continues the analysis with additional processing and visualization.

GeoAI Random Forest Classifier and Population Exposure Analysis
// Generate pseudo-presence and absence sampling locations for suitability training
// Note: Real disease incidence or vector presence coordinates should be imported securely
var presencePoints = ee.FeatureCollection.randomPoints(roi, 100, 42)
  .map(function(f) { return f.set('class', 1); });
var absencePoints = ee.FeatureCollection.randomPoints(roi, 100, 99)
  .map(function(f) { return f.set('class', 0); });

var trainingSample = presencePoints.merge(absencePoints);

// Sample spatial covariates at point locations
var trainingData = predictors.sampleRegions({
  collection: trainingSample,
  properties: ['class'],
  scale: 1000,
  geometries: false
});

// Train Random Forest classifier for vector niche modeling
var classifier = ee.Classifier.smileRandomForest(50).train({
  features: trainingData,
  classProperty: 'class',
  inputProperties: ['mean_temp_c', 'total_precip_mm', 'mean_ndvi']
});

// Predict spatial environmental suitability
var suitabilityMap = predictors.classify(classifier).rename('suitability');

// Overlay suitability prediction with WorldPop to isolate exposed population
var highRiskPop = population.updateMask(suitabilityMap.eq(1)).clip(roi);

// Visualization
Map.addLayer(suitabilityMap, {min: 0, max: 1, palette: ['lightgray', 'darkred']}, 'Predicted Risk Class');
Map.addLayer(highRiskPop, {min: 0, max: 500, palette: ['yellow', 'orange', 'purple']}, 'Exposed Population Density');

// Calculate total exposed population across the region
var totalExposed = highRiskPop.reduceRegion({
  reducer: ee.Reducer.sum(),
  geometry: roi,
  scale: 1000,
  maxPixels: 1e9
});
print('Estimated High-Risk Exposed Population:', totalExposed);
🔑
Beginner note: In this block, we train a Random Forest classifier using sampled environmental variables corresponding to vector presence and absence proxies. The output classifies ecological suitability across the region. We then mask high-resolution WorldPop demographic counts to calculate the total exposed population residing within high-suitability zones.

6
Export Results to Google Drive
5 min

Add this block at the end of your script to export the final map as a GeoTIFF to your Google Drive. After clicking Run, go to the Tasks tab in GEE and click Run next to each export task.

Export to Google Drive
// Export the continuous predicted disease suitability map to Google Drive
Export.image.toDrive({
  image: suitabilityMap,
  description: 'Vector_Disease_Suitability_Map_2022',
  folder: 'GEE_Spatial_Epidemiology',
  fileNamePrefix: 'suitability_risk_map_1km',
  region: roi,
  scale: 1000,
  maxPixels: 1e9,
  crs: 'EPSG:4326'
});
🔑
Beginner note -- Export.image.toDrive(): This function does not export immediately. It creates a task in the GEE Tasks tab that you must manually start by clicking Run. The file will appear in your Google Drive folder (GEE_Courses) as a GeoTIFF that you can open in QGIS or ArcGIS.

7
Exercises Using DeepSeek Prompts
Homework

Use DeepSeek to extend the script for each exercise below. Write a follow-up prompt describing what you want to add, then copy the generated code and paste it into your GEE script.

Exercise A: Climate Sensitivity Threshold Analysis

  1. Modify the ERA5-Land filtering code to extract minimum temperature and maximum monthly precipitation instead of annual means.
  2. Re-evaluate how extreme seasonal climate thresholds alter vector niche boundaries.
  3. Compare the predicted high-suitability area under mean conditions versus seasonal extremes.

Exercise B: Mitigating Spatial Autocorrelation

  1. Implement a spatial block thinning approach by filtering presence points using a minimum distance threshold (e.g., 50 km).
  2. Retrain the Random Forest classifier using the spatially thinned dataset.
  3. Compare variable importance scores before and after controlling for spatial proximity bias.

Exercise C: Multi-Temporal Trend Analysis

  1. Create a second predictor stack for an earlier decade (e.g., year 2010).
  2. Run the trained classifier on the 2010 image stack to produce a historical suitability map.
  3. Subtract the 2010 suitability map from the 2022 map to identify emerging risk hotspots.

Exercise D: Administrative Aggregation and MAUP Evaluation

  1. Load simplified administrative level-1 boundaries using USDOS/LSIB_SIMPLE/2017.
  2. Reduce the continuous suitability map by administrative polygon using ee.Reducer.mean().
  3. Discuss how changing administrative scale impacts public health resource allocation decisions.

8
Prompt Engineering Tips
Reference

To get the best results from DeepSeek for GEE tasks, always include these elements in your prompts:

ElementExample
Exact dataset IDECMWF/ERA5_LAND/MONTHLY_AGGR
Band names"select band 'B4' for red, 'B8' for NIR"
Study area"rectangle [-6.5, 33.0, -1.5, 36.0] North Morocco"
Date range"filter from 2020-01-01 to 2023-12-31"
Output format"print area in hectares, add a legend, export to Drive"
Error fixing"The code gives error X. Please fix it."
Iteration"Add a time series chart for each year 2018-2023"
🧠
Best practice: Start with the main prompt, run the code, then send follow-up prompts to add features one at a time. This gives you cleaner, more reliable code than asking for everything at once.
Course 32 - Global Spatial Epidemiology: GeoAI Machine Learning for Environmental Disease Risk Mapping | GeoAI for Climate Change | Dr. Ayoub Lahlouh | UM6P/CUS | 2025/2026