Image Overview

2020-01-04 488 words 3 mins read

Adapted from Google Earth Engine Documentation.

raster data are represented as Image objects in Earth Engine. Images are composed of one or more bands and each band has its own name, data type, scale, mask and projection. Each image has metadata stored as a set of properties.

1. ee.Image constructor

Images can be loaded by pasting an Earth Engine asset ID into the ee$Image constructor. You can find image IDs in the data catalog. For example, to load JAXA’s ALOS DSM:

srtm <- ee$Image("USGS/SRTMGL1_003")

2. Get an ee.Image from an ee.ImageCollection

The standard way to get an image out of a collection is to filter the collection, with filters in order of decreasing specificity. For example, to get an image out of the Sentinel-2 surface reflectance collection:

# Load an image collection
sen <- ee$ImageCollection("COPERNICUS/S2")$
  filterBounds(ee$Geometry$Point(-70.48, 43.3631))$
  filterDate('2019-01-01', '2019-12-31')$

# Define the visualization parameters.
vizParams <- list(
  bands = c("B4", "B3", "B2"),
  min = 0,
  max = 2000,
  gamma = c(0.95, 1.1, 1)

# Center the map and display the image.
Map$centerObject(sen, 7)
# You can see it
m1 <- Map$addLayer(sen, vizParams, 'first')

Figure N°01: Sentinel-2 RGB Porland,USA

Note that the sort is after the filters. Avoid sorting the entire collection.

To display the results in QGIS copy m1$rgee$tokens into XYZ Tiles:

#[1] > "{z}/{x}/{y}"

Figure N°02: rgee & QGIS map integration

3. Images from Cloud GeoTIFFS

You can use ee$Image$loadGeoTIFF() to load images from Cloud Optimized GeoTIFFs in Google Cloud Storage. For example, the public Landsat dataset hosted in Google Cloud contains this GeoTIFF, corresponding to band 5 from a Landsat 8 scene. You can load this image from Cloud Storage using ee$Image$loadGeoTIFF():

uri <- sprintf(

cloudImage <- ee$Image$loadGeoTIFF(uri)


Note that if you want to reload a Cloud Optimized GeoTIFF that you export from Earth Engine to Cloud Storage, when you do the export, set cloudOptimized to true as described here.

4. Constants images

In addition to loading images by ID, you can also create images from constants, lists or other suitable Earth Engine objects. The following illustrates methods for creating images, getting band subsets, and manipulating bands:



# Create a constant Image with a pixel value of 1.
image1 <- ee$Image(1)
print(image1, type = "json")
print(image1, type = "simply")
print(image1, type = "ee_print")
# You can see it.

# Concatenate two Images into one multi-band image.
image2 <- ee$Image(2)
image3 <- ee$Image$cat(c(image1, image2))
ee_print(image3, clean = TRUE)

# Change print option by: "simply","json","ee_print"
options(rgee.print.option = "simply")

# Create a multi-band image from a list of constants.
multiband <- ee$Image(c(1, 2, 3))

# Select and (optionally) rename bands.
renamed <- multiband$select(
  opt_selectors = c("constant", "constant_1", "constant_2"), # old names
  opt_names = c("band1", "band2", "band3")                   # new names

# Add bands to an image.
image4 <- image3$addBands(ee$Image(42))

Fernando Prudencio

This article is licensed under a Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it