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 |
|---|---|---|
| UHI | Urban Heat Island | A metropolitan area which is significantly warmer than its surrounding rural areas. |
| LST | Land Surface Temperature | The radiative skin temperature of the land surface, measured in Kelvin or Celsius. |
| NDVI | Normalized Difference Vegetation Index | A simple graphical indicator that measures the amount of live green vegetation. |
| Emissivity | Surface Emissivity | The measure of an object's ability to emit infrared energy. |
| Landsat | Landsat Program | A long-running Earth observation satellite program. |
| GEE | Google Earth Engine | A cloud-based platform for planetary-scale geospatial analysis. |
| TIRS | Thermal Infrared Sensor | The sensor on Landsat satellites that measures thermal radiation. |
| OLI | Operational Land Imager | The sensor on Landsat satellites that measures visible and near-infrared radiation. |
| Surface Reflectance | Surface Reflectance | The fraction of incoming solar radiation reflected from the Earth's surface after atmospheric correction. |
| Atmospheric Correction | Atmospheric Correction | The process of removing atmospheric effects from satellite imagery. |
| Pixel | Picture Element | The smallest addressable element in an image. |
| Band | Spectral Band | A specific range of wavelengths in the electromagnetic spectrum that a sensor is sensitive to. |
| Threshold | Threshold | A value used to separate data into different categories. |
| Algorithm | Algorithm | A process or set of rules to be followed in calculations or other problem-solving operations. |
Urban Heat Islands (UHIs) are a growing concern, especially in rapidly urbanizing areas. This course will guide you through mapping UHIs in North Morocco using Landsat 8 data and the power of Google Earth Engine and DeepSeek AI, providing a hands-on experience in remote sensing and GeoAI.
LANDSAT/LC08/C01/T1_SRYou need two browser tabs open side by side throughout this course.
Course5_Urban Heat Island Mapping with Landsat and DeepSeek
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 the region of interest (Fez, Morocco)
var fez = ee.Geometry.Point([ -5.0069, 34.0372]);
// Define the date range
var startDate = '2023-07-01';
var endDate = '2023-08-31';
// Load Landsat 8 SR data
var landsat8 = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filterBounds(fez)
.filterDate(startDate, endDate)
.filter(ee.Filter.lt('CLOUD_COVER', 20));
// Function to calculate NDVI
var calculateNDVI = function(image) {
return image.normalizedDifference(['B5', 'B4']).rename('NDVI');
};
// Apply NDVI calculation to the Landsat 8 collection
var ndviCollection = landsat8.map(calculateNDVI);
// Composite the NDVI collection (e.g., median)
var ndvi = ndviCollection.median();
//Display NDVI
Map.addLayer(ndvi, {min: -1, max: 1, palette: ['blue', 'white', 'green']}, 'NDVI');
Add this block after the previous code. It continues the analysis with additional processing and visualization.
// Function to calculate LST (simplified)
var calculateLST = function(image) {
var thermalBand = image.select('B10');
var kelvin = thermalBand.multiply(0.1).add(273.15); // Convert to Kelvin
return kelvin.rename('LST');
};
// Apply LST calculation to the Landsat 8 collection
var lstCollection = landsat8.map(calculateLST);
// Composite the LST collection (e.g., median)
var lst = lstCollection.median();
//Display LST
Map.addLayer(lst, {min: 290, max: 320, palette: ['blue', 'yellow', 'red']}, 'LST');
// Define a threshold for UHI (e.g., LST > 308 K)
var uhiThreshold = 308;
// Create a UHI mask
var uhiMask = lst.gt(uhiThreshold);
// Display the UHI mask
Map.addLayer(uhiMask.updateMask(uhiMask), {palette: 'red'}, 'UHI Mask');
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 the LST image to Google Drive
Export.image.toDrive({
image: lst,
description: 'LST_Fez',
folder: 'GEE_Exports',
scale: 30,
region: fez,
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 | LANDSAT/LC08/C01/T1_SR |
| 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" |