Google Earth Engine

Getting Started

Render Sentinel 2 imagery

Export an image

What is Google Earth Engine? 

  • Computing platform and runs in your internet browser
    • with a code editor,
    • offers a compiler that runs in the Google cloud,
    • hosts data on Google servers.
  • Integrated Development Environment (IDE)

 

Google Earth Engine is a

Data Repository (data as a service)

Software as a Service (SaaS)

Platform as a service (PaaS)

 

 

 

User Interface

{JavaScript}

is an interactive front-end scripting language

Statements - individual instruction or steps

statements end with a ;

 

Comments - explains what code does

// Displays a map

 

JavaScript is case sensitive

 

Variable - tell the system to remember or store data or a value

 

First Declare a variable

 

Then assign a value to a variable

 

{Hello World}

Let's try some simple examples

Add Data and show it on the map

cut and paste this code into your code window

//call dataset with GPP
var dataset = ee.ImageCollection('MODIS/061/MOD17A2H')
                  .filter(ee.Filter.date('2021-01-01', '2021-05-01'));
//call only GPP
var gpp = dataset.select('Gpp');
//Visualize the GPP
var gppVis = {
  min: 0,
  max: 600,
  palette: ['bbe029', '0a9501', '074b03'],
};

//center map
Map.setCenter(6.746, 46.529, 2);
//render the GPP data
Map.addLayer(gpp, gppVis, 'GPP');

print(gpp)

set the geometry manually - draw the box

in the map interface and adjust the transparency - then hit run

What do you see? 

select the Inspector tab on the top right

Then Click anywhere in your map  

Notice there is a DN for each band  

Now change some of the parameters

just to explore

change the band combinations

Change the date ranges

Export image

Subtitle


// Export the sentinel 2 image to your google drive - name the image the location and date you selected in your code
Export.image.toDrive({
image: S2_mosaic,region: geometry,
 description: 'UtrechtMayJune2018',
 scale: 30,

Subtitle

//call sentinel 2 images specify date and cloud filter
var S2_collection = ee.ImageCollection("COPERNICUS/S2")
  .filterBounds(geometry)
  .filterDate('2018-05-01', '2018-06-14')
  .filterMetadata('CLOUDY_PIXEL_PERCENTAGE', 'less_than', 10);
 
  
  //what bands to make visible in the map below - clip only the imagery within the specific geometry or box you set
var S2_mosaic = S2_collection.median().clip(geometry);
var S2_display = {bands: ['B4', 'B3', 'B2'], min: 0, max: 3000};

//show the data on the map

Map.addLayer(S2_mosaic, S2_display, "Sentinel-2");

//center the map on the point of interest defined

Map.centerObject(geometry);

// Export the sentinel 2 image
Export.image.toDrive({
image: S2_mosaic,region: geometry,
 description: 'UtrechtMayJune2018',
 scale: 30,

});

with uu geometry baked in

Subtitle

//baked in geo
 var geometry = 
    /* color: #d63000 */
    /* shown: false */
    /* displayProperties: [
      {
        "type": "rectangle"
      }
    ] */
    ee.Geometry.Polygon(
        [[[5.058019540799301, 52.15382123004126],
          [5.058019540799301, 51.96383817630241],
          [5.395505807889145, 51.96383817630241],
          [5.395505807889145, 52.15382123004126]]], null, false);

//call sentinel 2 images specify date
var S2_collection = ee.ImageCollection("COPERNICUS/S2")
  .filterBounds(geometry)
  .filterDate('2018-05-01', '2018-06-14')
  .filterMetadata('CLOUDY_PIXEL_PERCENTAGE', 'less_than', 10);
 
 
  
  //what bands to make visible in the map below - clip only the imagery within the specific geometry or box you set
var S2_mosaic = S2_collection.median().clip(geometry);
var S2_display = {bands: ['B4', 'B3', 'B2'], min: 0, max: 3000};

//show the data on the map

Map.addLayer(S2_mosaic, S2_display, "Sentinel-2");

//center the map on the point of interest defined

Map.centerObject(geometry);

// Export the sentinel 2 image
Export.image.toDrive({
image: S2_mosaic,region: geometry,
 description: 'UtrechtMayJune2018',
 scale: 30,

});

  1. Hit Run to run the code
  2. Then the Tasks Tab should turn orange
  3. Click it
  4. You will see the file name will appear with a button that says Run
  5. click run to start the export process

To export the image

ArcGIS Pro

Give me more!

Google Earth Engine UCU 2024

By Britta Ricker

Google Earth Engine UCU 2024

  • 126