Before starting, make sure you understand these terms. They appear throughout all code blocks in this course.
| Term | Full Name | What it means in simple words |
|---|---|---|
| PopDensity | Population Density | The concentration of human individuals living within a defined spatial area unit. |
| VulnerabilityIndex | Composite Vulnerability Index | A mathematical metric combining sensitivity, exposure, and adaptive capacity variables into a single score. |
| EnvExposure | Environmental Exposure | The extent to which human populations come into contact with harmful ambient conditions such as air pollution or extreme thermal heat. |
| HeatStress | Thermal Heat Stress | Physiological strain on the human body caused by prolonged exposure to elevated environmental temperatures. |
| AirPollution | Ambient Air Pollution | Atmospheric contamination by harmful gases and particulate matter that adversely impact respiratory health. |
| Sensitivity | Population Sensitivity | Pre-existing biological or demographic factors that increase susceptibility to adverse health impacts. |
| AdaptiveCapacity | Community Adaptive Capacity | The ability of systems, institutions, and individuals to respond to and recover from health risks. |
| SpatialHarmonization | Spatial Data Harmonization | The process of aligning datasets with different spatial resolutions, projections, and formats into a common grid. |
| RasterMinMax | Min-Max Raster Normalization | A scaling technique that rescales continuous raster layer values into a standardized range between 0 and 1. |
| CompositeIndicator | Multi-Criteria Composite Indicator | An aggregated spatial layer constructed by weighting multiple normalized risk indicators. |
| SpatialAutocorrelation | Spatial Autocorrelation | The formal statistical measure of spatial dependency where nearby locations share similar value distributions. |
| GeographicUnit | Spatial Aggregation Unit | The specific boundary or raster grid cell size used to summarize spatial observations for epidemiological analysis. |
Mapping global population vulnerability requires integrating high-resolution demographic distribution, ambient air pollution, and severe thermal heat stress parameters. Public health organizations rely on spatial decision-support tools to identify communities at disproportionate risk from climate and environmental hazards. This course demonstrates how to leverage Google Earth Engine to harmonize heterogeneous global datasets, calculate spatial exposure indicators, and construct reproducible health vulnerability maps.
WorldPop/GP/100m/popYou need two browser tabs open side by side throughout this course.
Course33_Global Population Vulnerability Mapping for Public Health Risk Assessment
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.
Paste the following code into your GEE code editor and click Run. Read the beginner notes below to understand what each line does.
// Define a study area ROI over a representative metropolitan area
var roi = ee.Geometry.Rectangle([72.7, 18.8, 73.0, 19.3]); // Mumbai Metro Region
Map.centerObject(roi, 10);
Map.setOptions('HYBRID');
// Load WorldPop Population Dataset (2020)
var pop = ee.ImageCollection('WorldPop/GP/100m/pop')
.filter(ee.Filter.date('2020-01-01', '2020-12-31'))
.select('population')
.mean()
.clip(roi);
// Load Sentinel-5P NO2 Air Pollution Data (2020)
var no2 = ee.ImageCollection('COPERNICUS/S5P/OFFL/L3_NO2')
.filterBounds(roi)
.filterDate('2020-01-01', '2020-12-31')
.select('NO2_column_number_density')
.mean()
.clip(roi);
// Load ERA5-Land Air Temperature and convert Kelvin to Celsius
var temp = ee.ImageCollection('ECMWF/ERA5_LAND/MONTHLY_AGGR')
.filterBounds(roi)
.filterDate('2020-05-01', '2020-06-30') // Warmest summer season
.select('temperature_2m')
.mean()
.subtract(273.15)
.clip(roi);
// Resample air quality and temperature to match 100m WorldPop spatial scale
var targetScale = 100;
var popResampled = pop.reproject({crs: 'EPSG:4326', scale: targetScale});
var no2Resampled = no2.resample('bilinear').reproject({crs: 'EPSG:4326', scale: targetScale});
var tempResampled = temp.resample('bilinear').reproject({crs: 'EPSG:4326', scale: targetScale});
// Define helper function for Min-Max normalization (0 to 1 scaling)
function normalize(img, region, scale) {
var stats = img.reduceRegion({
reducer: ee.Reducer.minMax(),
geometry: region,
scale: scale,
maxPixels: 1e9
});
var minKey = img.bandNames().get(0).getInfo() + '_min';
var maxKey = img.bandNames().get(0).getInfo() + '_max';
var minVal = ee.Number(stats.get(minKey));
var maxVal = ee.Number(stats.get(maxKey));
return img.subtract(minVal).divide(maxVal.subtract(minVal)).clamp(0, 1);
}
// Normalize baseline exposure components
var normPop = normalize(popResampled, roi, targetScale);
var normNO2 = normalize(no2Resampled, roi, targetScale);
var normTemp = normalize(tempResampled, roi, targetScale);
// Visualization settings
Map.addLayer(normPop, {min: 0, max: 1, palette: ['white', 'blue']}, 'Normalized Population Density');
Map.addLayer(normNO2, {min: 0, max: 1, palette: ['white', 'yellow', 'orange']}, 'Normalized NO2 Exposure');
Map.addLayer(normTemp, {min: 0, max: 1, palette: ['white', 'red']}, 'Normalized Thermal Heat Stress');
Add this block after the previous code. It continues the analysis with additional processing and visualization.
// Combine normalized factors into a multi-criteria Vulnerability Index
// Weights: Population Sensitivity (0.4), Air Quality (0.3), Heat Stress (0.3)
var vulnerabilityIndex = normPop.multiply(0.4)
.add(normNO2.multiply(0.3))
.add(normTemp.multiply(0.3))
.rename('Vulnerability_Index');
// Apply spatial smoothing filter to reduce high-frequency grid noise
var smoothVulnerability = vulnerabilityIndex.reduceNeighborhood({
reducer: ee.Reducer.mean(),
kernel: ee.Kernel.square({radius: 200, units: 'meters'})
});
// Define color palette for public health mapping
var healthPalette = [
'#2b83ba', // Very Low Vulnerability (Blue)
'#abdda4', // Low Vulnerability (Green)
'#ffffbf', // Moderate Vulnerability (Yellow)
'#fdae61', // High Vulnerability (Orange)
'#d7191c' // Very High Vulnerability (Red)
];
// Display composite vulnerability raster layer
Map.addLayer(smoothVulnerability, {
min: 0.1,
max: 0.8,
palette: healthPalette
}, 'Population Vulnerability Index');
// Calculate zonal mean vulnerability across sub-administrative areas
var adminUnits = ee.FeatureCollection('FAO/GAUL/2015/level2')
.filterBounds(roi);
var adminVulnerability = smoothVulnerability.reduceRegions({
collection: adminUnits,
reducer: ee.Reducer.mean().combine({
reducer2: ee.Reducer.stdDev(),
sharedInputs: true
}),
scale: targetScale
});
// Highlight high vulnerability administrative units
Map.addLayer(adminUnits.style({color: 'black', fillColor: '00000000'}), {}, 'District Boundaries');
print('Mean Vulnerability by District:', adminVulnerability);
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 final vulnerability index raster layer to Google Drive
Export.image.toDrive({
image: smoothVulnerability,
description: 'Global_Population_Vulnerability_Index_2020',
folder: 'GEE_PublicHealth_Outputs',
scale: 100,
region: roi,
fileFormat: 'GeoTIFF',
maxPixels: 1e9
});
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.
To get the best results from DeepSeek for GEE tasks, always include these elements in your prompts:
| Element | Example |
|---|---|
| Exact dataset ID | WorldPop/GP/100m/pop |
| 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" |