Practical Course 28

Global Urban Heat Exposure and Health Risk Mapping with GeoAI

Model land surface temperature, population vulnerability, and urban heat exposure across major metropolitan areas using Landsat and Earth observation data.
Global Cities ~2 hours Advanced
Dataset: LANDSAT/LC08/C02/T1_L2 USGS Landsat 8 Collection 2 Level-2 Science Products

📖 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
LSTLand Surface TemperatureThe radiometric temperature of the land surface emitted by Earth, derived from thermal infrared satellite sensors.
UHIUrban Heat IslandA phenomenon where urban areas experience significantly higher temperatures than surrounding rural context due to human structure and reduced vegetation.
HVIHeat Vulnerability IndexA spatial composite metric combining thermal exposure, population sensitivity, and adaptive capacity factors.
Environmental ExposureEnvironmental ExposureThe contact between a human population and an environmental hazard, such as extreme surface heat, over a specific geographic area and duration.
NDVINormalized Difference Vegetation IndexA standardized spectral index calculating green vegetation density using red and near-infrared reflectance bands.
NDBINormalized Difference Built-up IndexA spectral index sensitive to impervious surface cover and urban structures, calculated from shortwave infrared and near-infrared bands.
Thermal EmissivityLand Surface EmissivityThe efficiency of a surface in emitting thermal radiation relative to a black body at the same temperature.
Population ExposurePopulation Exposure AssessmentThe intersection of population density maps with environmental hazards to estimate total human count impacted by severe conditions.
Random Forest RegressionRandom Forest RegressionAn ensemble machine learning algorithm that builds multiple decision trees to predict continuous targets like localized thermal anomalies.
Spatial AutocorrelationSpatial AutocorrelationThe spatial clustering property where geographic features located close to each other exhibit similar thermal or vulnerability values.
Health Risk ProxyHealth Risk Proxy VariableAn environmental or socio-demographic metric used to represent potential health risk when direct epidemiological outcome data are unavailable.
Modifiable Areal Unit ProblemModifiable Areal Unit Problem (MAUP)A statistical bias occurring when point or raster data are aggregated into different administrative boundaries or spatial resolutions.

Contents

  1. 1. Introduction to Extreme Heat and Public Health Science
  2. 2. Satellite Remote Sensing of Land Surface Temperature (LST)
  3. 3. Preprocessing Landsat 8/9 Surface Temperature and Emissivity
  4. 4. Spectral Feature Extraction: Canopy and Impervious Indices
  5. 5. Spatial Population Mapping and Harmonization
  6. 6. Formulating the Spatial Heat Vulnerability Index (HVI)
  7. 7. Machine Learning Predictive Modeling with Random Forest
  8. 8. Multi-City Comparative Analysis and Model Generalization
  9. 9. Ethical Considerations and Distinguishability of Exposure vs Disease
  10. 10. Exporting GeoAI Maps and Actionable Health Risk Dashboards
1
Introduction
10 min

Rapid urbanization and climate change have exacerbated severe extreme heat events in cities worldwide, threatening public health and overburdening medical infrastructure. This course demonstrates how to use Google Earth Engine and GeoAI workflows to combine Landsat thermal imagery, land cover spectral indices, and high-resolution WorldPop grid layers. Students will build transferable, spatial heat vulnerability indices and machine learning models to map urban heat exposure across global metropolitan areas, transforming satellite observations into actionable health risk intelligence.

GEE Asset ID
LANDSAT/LC08/C02/T1_L2
Dataset Name
USGS Landsat 8 Collection 2 Level-2 Science Products
Study Area
Global Cities
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 Urban Heat Exposure and Health Risk Mapping with GeoAI, 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 Course28_Global Urban Heat Exposure and Health Risk Mapping with GeoAI
💡
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
Act as an expert GeoAI and Spatial Epidemiology researcher. Write a complete Google Earth Engine JavaScript script to calculate Land Surface Temperature (LST) and build an Urban Heat Vulnerability Index (HVI) for a specified metropolitan region (e.g., Phoenix, Madrid, or Tokyo). Use the USGS Landsat 8 Collection 2 Level-2 dataset ('LANDSAT/LC08/C02/T1_L2') for summer months (June to August). Convert thermal band 'ST_B10' to Celsius using scale factor 0.00341802 and offset 149.0 (subtract 273.15). Calculate NDVI from 'SR_B5' and 'SR_B4', and NDBI from 'SR_B6' and 'SR_B5'. Mask clouds using QA_PIXEL. Combine LST with WorldPop population density ('WorldPop/GP/100m/pop'). Normalize LST, NDBI, and Population Density to a 0-1 scale, and calculate an additive Heat Vulnerability Index (HVI = 0.4*LST_norm + 0.3*NDBI_norm + 0.3*Pop_norm - 0.2*NDVI_norm). Add layers to map with appropriate color palettes (cividis, YlOrRd) and print summary statistics. Ensure no fake functions or unverified asset IDs are used.
✨
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
Landsat LST Preprocessing and Spectral Index Extraction
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.

Landsat LST Preprocessing and Spectral Index Extraction
var cityROI = ee.Geometry.Polygon([
  [[-112.15, 33.35], [-111.85, 33.35], [-111.85, 33.65], [-112.15, 33.65]]
]);

function maskLandsatSR(image) {
  var qa = image.select('QA_PIXEL');
  var cloudBitMask = 1 << 3;
  var shadowBitMask = 1 << 4;
  var mask = qa.bitwiseAnd(cloudBitMask).eq(0)
             .and(qa.bitwiseAnd(shadowBitMask).eq(0));
  return image.updateMask(mask);
}

var landsatCollection = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2')
  .filterBounds(cityROI)
  .filterDate('2023-06-01', '2023-08-31')
  .filter(ee.Filter.lt('CLOUD_COVER', 15))
  .map(maskLandsatSR);

var medianImage = landsatCollection.median().clip(cityROI);

var lstCelsius = medianImage.select('ST_B10')
  .multiply(0.00341802).add(149.0).subtract(273.15)
  .rename('LST');

var ndvi = medianImage.normalizedDifference(['SR_B5', 'SR_B4']).rename('NDVI');
var ndbi = medianImage.normalizedDifference(['SR_B6', 'SR_B5']).rename('NDBI');

var processedImage = ee.Image.cat([lstCelsius, ndvi, ndbi]);

Map.centerObject(cityROI, 11);
Map.addLayer(processedImage.select('NDVI'), {min: -0.1, max: 0.7, palette: ['blue', 'white', 'green']}, 'NDVI');
Map.addLayer(processedImage.select('NDBI'), {min: -0.3, max: 0.3, palette: ['white', 'orange', 'red']}, 'NDBI');
Map.addLayer(processedImage.select('LST'), {min: 25, max: 50, palette: ['blue', 'yellow', 'orange', 'red']}, 'Land Surface Temperature (C)');
🔑
Beginner note: This script filters Landsat 8 Collection 2 Level-2 scene composites over a urban study region during summer. It applies quality assessment pixel masking to remove cloud contamination. Surface temperature is converted from raw Kelvin digital numbers to degrees Celsius using official USGS scale factors. Spectral indices NDVI (vegetation) and NDBI (built-up imperviousness) are computed to serve as environmental drivers of urban heat accumulation.

5
Population Exposure Integration and GeoAI Vulnerability Modeling
10 min

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

Population Exposure Integration and GeoAI Vulnerability Modeling
var popImage = ee.ImageCollection('WorldPop/GP/100m/pop')
  .filterBounds(cityROI)
  .filter(ee.Filter.date('2020-01-01', '2020-12-31'))
  .mean()
  .clip(cityROI)
  .rename('Population');

function minMaxNormalize(img, region, scale) {
  var stats = img.reduceRegion({
    reducer: ee.Reducer.minMax(),
    geometry: region,
    scale: scale,
    maxPixels: 1e9
  });
  var minVal = ee.Number(stats.get(img.bandNames().get(0).aside(function(b){ return ee.String(b).cat('_min'); })));
  var maxVal = ee.Number(stats.get(img.bandNames().get(0).aside(function(b){ return ee.String(b).cat('_max'); })));
  return img.subtract(minVal).divide(maxVal.subtract(minVal)).clamp(0, 1);
}

var lstNorm = minMaxNormalize(processedImage.select('LST'), cityROI, 30).rename('LST_norm');
var ndbiNorm = minMaxNormalize(processedImage.select('NDBI'), cityROI, 30).rename('NDBI_norm');
var ndviNorm = minMaxNormalize(processedImage.select('NDVI'), cityROI, 30).rename('NDVI_norm');
var popNorm = minMaxNormalize(popImage.select('Population'), cityROI, 100).rename('Pop_norm');

var compositeVulnerability = lstNorm.multiply(0.35)
  .add(ndbiNorm.multiply(0.25))
  .add(popNorm.multiply(0.25))
  .add(ee.Image(1).subtract(ndviNorm).multiply(0.15))
  .rename('Heat_Vulnerability_Index');

var trainingPoints = compositeVulnerability.sample({
  region: cityROI,
  scale: 30,
  numPixels: 1000,
  seed: 42,
  geometries: true
});

var predictors = ee.Image.cat([processedImage.select(['NDVI', 'NDBI']), popImage]);

var classifier = ee.Classifier.smileRandomForest(50).train({
  features: trainingPoints,
  classProperty: 'Heat_Vulnerability_Index',
  inputProperties: ['NDVI', 'NDBI', 'Population']
});

Map.addLayer(popImage, {min: 0, max: 200, palette: ['white', 'purple']}, 'Population Density');
Map.addLayer(compositeVulnerability, {min: 0.2, max: 0.8, palette: ['blue', 'yellow', 'orange', 'darkred']}, 'Heat Vulnerability Index (HVI)');
🔑
Beginner note: This script integrates WorldPop population density data and normalizes environmental and demographic predictors to a uniform 0 to 1 scale. It calculates an additive Heat Vulnerability Index (HVI) combining surface temperature, impervious structures, population density, and vegetation deficit. Training samples are generated from the composite index to demonstrate machine learning regression workflows using Random Forest algorithms in Earth Engine.

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.image.toDrive({
  image: compositeVulnerability,
  description: 'Global_City_Heat_Vulnerability_Index_2023',
  folder: 'GEE_Public_Health_GeoAI',
  scale: 30,
  region: cityROI,
  fileFormat: 'GeoTIFF',
  maxPixels: 1e9
});
🔑
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 1: Comparative Urban Heat Island Analysis across Cities

  1. Change the study area polygon coordinates to target a contrasting global city (e.g., Tokyo, Madrid, or Sao Paulo).
  2. Adjust date filtering to reflect the peak local summer month for the selected hemisphere.
  3. Compare mean Land Surface Temperature (LST) values between dense urban core zones and surrounding vegetated suburban parks.

Exercise 2: Sensitivity Analysis of HVI Weights

  1. Modify the relative weighting parameters of LST, NDBI, Population, and NDVI in the composite HVI formula.
  2. Recompute the spatial distribution of top decile high-vulnerability hot spots.
  3. Evaluate how heavily weighting population density vs environmental LST changes the identified target urban districts.

Exercise 3: Integrating Air Temperature Baseline Context

  1. Import the ECMWF ERA5-Land hourly temperature dataset ('ECMWF/ERA5_LAND/HOURLY').
  2. Extract 2-meter air temperature ('temperature_2m') for the matching satellite image acquisition time.
  3. Plot the pixel-wise relationship between satellite-derived LST and atmospheric air temperature across the city.

Exercise 4: Random Forest Hyperparameter Tuning and Prediction

  1. Increase the number of decision trees in the Random Forest model from 50 to 150.
  2. Add additional spectral predictor bands (e.g., Shortwave Infrared SR_B7 or Modified Normalized Difference Water Index MNDWI).
  3. Export model feature importance rankings to identify the top spatial driver of extreme urban heat exposure.

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 IDLANDSAT/LC08/C02/T1_L2
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 28 - Global Urban Heat Exposure and Health Risk Mapping with GeoAI | GeoAI for Climate Change | Dr. Ayoub Lahlouh | UM6P/CUS | 2025/2026