Generate Land Surface Temperature (LST) Maps in GEE | Code & Area Customization

Land Surface Temperature (LST) map using MODIS data in Google Earth Engine with code overlay

Land Surface Temperature (LST) is one of the most important indicators in environmental science. It tells us how hot the Earth's surface is and plays a key role in studying climate change, urban heat islands, drought, and agricultural stress.

In this tutorial, we will use Google Earth Engine (GEE) to extract and visualize LST data using MODIS MOD11A2 — with full code and a detailed line-by-line explanation. Whether you're a student, researcher, or environmental analyst, this guide will help you get started with LST processing in the cloud.


🛰️ What Dataset Are We Using?

We’ll use the MODIS MOD11A2 product:

  • Name: MOD11A2 Version 6

  • Resolution: 1 km

  • Temporal: 8-day composites

  • Bands: LST_Day_1km, LST_Night_1km

We’ll focus on the LST_Day_1km band for daytime temperatures.


🛠️ Step-by-Step GEE Code with Explanation

📌 1. Load the MODIS LST Dataset

var dataset = ee.ImageCollection('MODIS/006/MOD11A2')
                .filterDate('2024-01-01', '2024-03-31')
                .select('LST_Day_1km');

Explanation:

  • MODIS/006/MOD11A2: Loads MODIS Land Surface Temperature (8-day composite).

  • filterDate(...): Filters for January to March 2024.

  • select('LST_Day_1km'): Chooses daytime LST at 1 km resolution.



🌍 2. Define Your Area of Interest (AOI)

var aoi = ee.Geometry.Rectangle([72.8, 33.5, 73.3, 33.9]);

Explanation:

  • This is a rectangular region over Islamabad, Pakistan.

  • 🧩 Replace this with your own coordinates to analyze a different area.


🧮 3. Calculate Average LST

var meanLST = dataset.mean().clip(aoi);

Explanation:

  • mean(): Calculates the average LST across all 8-day images.

  • clip(aoi): Restricts the output to your area only.


🌡️ 4. Convert to Celsius

var lstCelsius = meanLST.multiply(0.02).subtract(273.15);

Explanation:

  • MODIS LST values are scaled by 0.02.

  • Then we subtract 273.15 to convert from Kelvin to Celsius.


🗺️ 5. Visualize the LST Map

Map.centerObject(aoi, 9);
Map.addLayer(lstCelsius, 
  {min: 20, max: 45, palette: ['blue', 'green', 'yellow', 'red']}, 
  'LST in Celsius');

Explanation:

  • centerObject(...): Zooms in on your AOI.

  • addLayer(...): Displays the LST map using a heat-color palette.


📤 6. Export to Google Drive (Optional)

Export.image.toDrive({
  image: lstCelsius,
  description: 'LST_Islamabad',
  scale: 1000,
  region: aoi,
  maxPixels: 1e13
});

Explanation:

  • This step allows you to download the processed LST image from GEE to your Google Drive.

  • Set the scale to match MODIS resolution (1000 m).


📦 Full Code (Copy & Paste Ready)

// 1. Load MODIS LST dataset (8-day composite)
var dataset = ee.ImageCollection('MODIS/006/MOD11A2')
                .filterDate('2024-01-01', '2024-03-31')
                .select('LST_Day_1km');

// 2. Define Area of Interest (Replace this with your own coordinates)
var aoi = ee.Geometry.Rectangle([72.8, 33.5, 73.3, 33.9]); // 🔁 Change this line for your location

// 3. Compute average LST over the selected time
var meanLST = dataset.mean().clip(aoi);

// 4. Convert from Kelvin to Celsius
var lstCelsius = meanLST.multiply(0.02).subtract(273.15);

// 5. Visualization settings
Map.centerObject(aoi, 9);
Map.addLayer(lstCelsius, 
  {min: 20, max: 45, palette: ['blue', 'green', 'yellow', 'red']}, 
  'LST in Celsius');

// 6. Export to Google Drive (optional)
Export.image.toDrive({
  image: lstCelsius,
  description: 'LST_Islamabad',
  scale: 1000,
  region: aoi,
  maxPixels: 1e13
});

🔄 How to Replace the AOI

Find coordinates of your desired location and replace this line:

var aoi = ee.Geometry.Rectangle([xmin, ymin, xmax, ymax]);

Example: Rectangle over Mumbai, India

var aoi = ee.Geometry.Rectangle([72.77, 18.89, 72.94, 19.3]);

✅ Conclusion

Using Google Earth Engine, you can easily process and analyze Land Surface Temperature data from MODIS in just a few lines of code. This tutorial gave you a complete walk-through — from loading the dataset to exporting a fully visualized LST map in Celsius.


Post a Comment

0 Comments