Google Earth Engine (GEE) is a cloud-based platform for geospatial analysis. It provides access to large satellite image archives, environmental datasets, and tools for processing data directly in the cloud.
This section introduces the main Earth Engine objects and operations used throughout the workshop.
Core Earth Engine objects¶
ee.Image¶
An ee.Image is a raster dataset. It can contain one band or many bands.
var srtm = ee.Image("USGS/SRTMGL1_003");Images can represent elevation, reflectance, NDVI, NBR, classification results, or disturbance year.
ee.ImageCollection¶
An ee.ImageCollection is a set of images, often representing repeated observations through time.
var s2 = ee.ImageCollection("COPERNICUS/S2_SR_HARMONIZED");Image collections can be filtered by location, date, cloud cover, and other metadata.
Geometry¶
A geometry defines a spatial object such as a point, line, or polygon.
var point = ee.Geometry.Point([-79.3, 48.45]);In this workshop, geometries are used to define the region of interest, select pixels, clip rasters, and summarize values.
ee.Feature and ee.FeatureCollection¶
A feature is a geometry with attributes. A feature collection is a set of features.
var waterbody = ee.FeatureCollection(
"projects/naveenv/assets/cef2026/waterbody_ferld"
);Feature collections can represent waterbodies, roads, plots, training samples, management units, or forest inventory polygons.
Common GEE operations¶
Filter an image collection¶
var s2Filtered = s2
.filterBounds(roi)
.filterDate("2023-01-01", "2023-12-31");Filtering keeps only the images needed for the study area and time period.
Select bands¶
var nir = image.select("B8");Band selection keeps the variables needed for analysis. For example, NDVI uses near-infrared and red bands, while NBR uses near-infrared and shortwave-infrared bands.
Calculate an index¶
var ndvi = image.normalizedDifference(["B8", "B4"]).rename("NDVI");Spectral indices combine bands to highlight vegetation condition, moisture, disturbance, or other surface properties.
Map a function over a collection¶
var withNDVI = s2.map(function(image) {
var ndvi = image.normalizedDifference(["B8", "B4"]).rename("NDVI");
return image.addBands(ndvi);
});.map() applies the same function to every image in an image collection.
Reduce values¶
Reducers summarize many pixel values into a smaller result.
var stats = image.reduceRegion({
reducer: ee.Reducer.mean(),
geometry: roi,
scale: 30
});Reducers are used to calculate summary statistics, mean NDVI, disturbed area, and accuracy metrics.
Display a layer¶
Map.addLayer(image, visParams, "Layer name");Map.addLayer() displays data in the Code Editor map. It does not export or save the result.
Export a result¶
Export.image.toDrive({
image: image,
description: "export_name",
folder: "GEE_exports",
region: roi,
scale: 30,
maxPixels: 1e13
});Exporting creates a task that saves a raster result outside Earth Engine, for example to Google Drive.
Client-side and server-side thinking¶
Most Earth Engine objects are server-side objects. They describe computations that run on Google’s servers.
A normal JavaScript number is client-side. An ee.Number is server-side. A normal JavaScript list is client-side. An ee.ImageCollection is server-side.
The key rule is:
Use Earth Engine methods for Earth Engine objects.
For example, use .map(), .filterDate(), .filterBounds(), .select(), .addBands(), and .reduceRegion() with Earth Engine objects.
Lazy evaluation¶
Earth Engine uses lazy evaluation. This means it does not run every operation immediately.
Instead, the script builds a processing plan. Earth Engine executes that plan when an output is requested, such as a map layer, printed value, chart, or export.
Why system:time_start matters?¶
Time series charts need a date for each image. Earth Engine usually stores this date in the system:time_start property.
For derived composites, such as monthly NDVI or annual NBR images, we often assign it manually:
.set("system:time_start", ee.Date.fromYMD(year, month, 15).millis())This places each composite correctly on a chart.
Visualizing versus exporting¶
Map visualization and data export are different.
Map.addLayer(image, visParams, "Layer name");This displays an image using colors and value ranges.
Export.image.toDrive({...});This saves raster values to a file.
A layer may look good on the map because of the visualization settings, but the exported raster contains the original data values unless you explicitly export a visualized image.
Basic GEE workflow¶
Most workshop examples follow the same structure:
define a region of interest
load an image or image collection
filter by date and region
mask unwanted pixels
calculate indices or terrain products
summarize values with reducers
display maps and charts
export final outputs
Questions¶
What is the difference between an
ee.Imageand anee.ImageCollection?Why do we filter image collections by date and region?
What does
.map()do in Earth Engine?What does a reducer do?
What is the difference between visualizing a layer and exporting a result?
Answers
An
ee.Imageis one raster dataset. Anee.ImageCollectionis a set of images, often representing repeated observations through time.Filtering keeps only the images relevant to the study area and time period.
.map()applies the same function to every image in a collection.A reducer summarizes many values into fewer values, such as a mean, sum, minimum, maximum, or count.
Visualization displays data on the map. Export saves raster data to a file for use outside Earth Engine.
Practical check questions¶
What does this line do?
var s2 = ee.ImageCollection("COPERNICUS/S2_SR_HARMONIZED");What does this line do?
.filterBounds(roi)What does this line do?
.filterDate("2023-01-01", "2023-12-31")Answers
It loads the Sentinel-2 Surface Reflectance Harmonized image collection from the Earth Engine Data Catalog.
It keeps only images that intersect the region of interest.
It keeps only images acquired between January 1 and December 31, 2023.