Getting started with Google Earth Engine

Hakim Benoudjit
3 min readApr 7, 2018

--

Google Earth Engine (GEE), for those who don’t know it, is a platform that allows to process satellite imagery directly on the cloud. It includes a Javascript IDE (text editor + interpreter), as well as a vast archive of images acquired by satellites like: Sentinel-1, Sentinel-2, and Landsat-8, among others.

To sign up to GEE, a Gmail account is necessary. All that needs to be done is to go to sign-up, and sign up to have access to GEE. Once the application is accepted an email like the following should be received:

The satellite image we’re going to use in this tutorial are stored directly on the cloud. However, GEE gives you the possibility to upload your own images from the assets tab situated at the left-hand side of the editor (only the GeoTiff format is supported for the time being).

A basic knowledge of Javascript is needed to get the hang of the code written in the GEE editor (one doesn’t need to be an expert in JS to understand the GEE functions, though). Plus, both the GEE API and JS can be learned at the same time. A good starting point are the official tutorials provided on the GEE website and the API. Another great resource to get help online is the Google Earth Engine Developers google group.

Now, let’s get into the fun stuff. To get started, we will load and display a Sentinel-2 optical image from the archive using dates and coordinates filters. A quick way to consult the documentation for each function that will be used in this tutorial is to look for it in the docs tab.

First, we need to load the archive of Sentinel-2 images (the var keyword is used to declare a new variable in Javascript):

After that, we will filter the previous ImageCollection by date. We also restrict the same collection only to images intersecting the geocoordinates (37°N, 3°E), which correspond to a point in the Mediterranean Sea (North of Algiers, capital of Algeria):

We will pick from the filtered collection the image containing the least cloud-cover, by sorting the collection in an ascending order according to this property and saving the first image in a separate variable:

If you wonder where the cloud-cover property came from, you can use the print() function to print any variable similarly to how console.log() is used in Javascript. Print(collection) will show in the Console tab the bands and the properties of the images in the collection.

Finally, we will show the image on the map situated below the editor. The view was zoomed on the (37°N, 3°E) geocoordinates, and then the image was added in a separate layer. We provide the bands to display as an array, where B4, B3, B2 correspond to the red, green, and blue bands in Sentinel-2 products, respectively. Also the max and mix values given as input serve to equalize the histogram of the image (i.e. to avoid having images that are too dark or too bright). You can get a feeling for the values to use as min/max by displaying the image as it is (i.e. without equalization), and checking the values for some pixels in each band from the Inspector tab:

The resulting image can be seen below:

Don’t forget to clap if this story has been useful to you.

--

--