{explore and download data from GEE}

Google Earth Engine for Land Cover Classification

Process

Explore

What data are available? What can we call from it? 

1.

2.

Build

Use examples, run code, and modify it for own purposes. 

3.

Map

Export data to use in our final project for land cover classification 

# CHAPTER 2

Final Result will look something like this

 

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)
  • Read more here

want more tutorials? https://tutorials.geemap.org/Image/image_visualization/

advanced https://courses.spatialthoughts.com/end-to-end-gee.html

 

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

 

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

 

Adding Data in Google Earth Engine

data types

ee.Image

ee.ImageCollection

ee.FeatureCollection 

 

Image - is just that - bands

Image Collection - only images but lots of them

Feature- features and elements - rasters and or polygons

Basic of JavaScript

for GEE

Feel free to dig deeper on your own here 

https://developers.google.com/earth-engine/tutorials/tutorials

 

Present Syntax Highlighted Code

  
//call landcover Modis

var modisLandcover = ee.ImageCollection('MODIS/061/MCD12Q1');

//call country boundary file

var countries = ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017")

// Load a country border to a region of interest (roi).These are recognized boardings of the USA

var roi = countries.filterMetadata('country_na', 'equals', 'Netherlands');

//center the map on the coutnry identified by the ROI

Map.centerObject(roi);

//Call Modis land cover dataset

//filter Modis landcover by date - check the datapage for possible date ranges
var filtered = modisLandcover.filter(
  ee.Filter.date('2012-01-01', '2012-12-31'))

//landcover for the year 2019
var landcover2019 = ee.Image(filtered.first())
//classify data based on land class type 1 
var classified = landcover2019.select('LC_Type1')

// clip to only your country
 var roiLandcover = classified.clip(roi)

 
 //color palette for the classification - this matches the Modus official color pallet but feel free to play here
var palette = ['05450a', '086a10', '54a708',
 '78d203', '009900', 'c6b044','dcd159', 
 'dade48', 'fbff13', 'b6ff05', '27ff87',
 'c24f44', 'a5a5a5', 'ff6d4c', '69fff8',
 'f9ffa4', '1c0dff']

//Call Corine landuse cover

var dataset2 = ee.Image('COPERNICUS/CORINE/V20/100m/2012');


//there are multiple datasets or classes in the above called data - specifiy which one you want in this case pick landcover
var Cor_landCover = dataset2.select('landcover');

//the dataset is global so select your ROI to clip the dataset - save energy and focus your users attention
var landcoverClip = Cor_landCover.clip(roi);

//render land use data on the map - only call your country/ROI which you clipped above- the string land cover is the label you will see in the layer name

Map.addLayer(landcoverClip, {}, 'Cor_landCover');


//add the visualized modis data to the map and label name landcover 2019 the entire world
Map.addLayer(roiLandcover,
{min:1, max:17, palette: palette},
'Modus Land cover 2012');

//add elevation data
var dem = ee.Image('CGIAR/SRTM90_V4');
var elevation = dem.select('elevation');

 // clip to only your country
 var elevationclip = elevation.clip(roi)
//add to map you can play with the color pallet and the max numbers to make the varation stick out
Map.addLayer(elevationclip, {min: 0, max: 1000, palette: ['#000004', '#50127b', '#b63679', '#fc8761', '#fdfd65']}, 'Elevation');
# PRESENTING CODE

Let's take a look at this Code in GEE

  
//call landcover Modis

var modisLandcover = ee.ImageCollection('MODIS/061/MCD12Q1');

//call country boundary file

var countries = ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017")

// Load a country border to a region of interest (roi).These are recognized boardings of the USA

var roi = countries.filterMetadata('country_na', 'equals', 'Netherlands');

//center the map on the coutnry identified by the ROI

Map.centerObject(roi);

//Call Modis land cover dataset

//filter Modis landcover by date - check the datapage for possible date ranges
var filtered = modisLandcover.filter(
  ee.Filter.date('2012-01-01', '2012-12-31'))

//landcover for the year 2019
var landcover2019 = ee.Image(filtered.first())
//classify data based on land class type 1 
var classified = landcover2019.select('LC_Type1')

// clip to only your country
 var roiLandcover = classified.clip(roi)

 
 //color palette for the classification - this matches the Modus official color pallet but feel free to play here
var palette = ['05450a', '086a10', '54a708',
 '78d203', '009900', 'c6b044','dcd159', 
 'dade48', 'fbff13', 'b6ff05', '27ff87',
 'c24f44', 'a5a5a5', 'ff6d4c', '69fff8',
 'f9ffa4', '1c0dff']

//Call Corine landuse cover

var dataset2 = ee.Image('COPERNICUS/CORINE/V20/100m/2012');


//there are multiple datasets or classes in the above called data - specifiy which one you want in this case pick landcover
var Cor_landCover = dataset2.select('landcover');

//the dataset is global so select your ROI to clip the dataset - save energy and focus your users attention
var landcoverClip = Cor_landCover.clip(roi);

//render land use data on the map - only call your country/ROI which you clipped above- the string land cover is the label you will see in the layer name

Map.addLayer(landcoverClip, {}, 'Cor_landCover');


//add the visualized modis data to the map and label name landcover 2019 the entire world
Map.addLayer(roiLandcover,
{min:1, max:17, palette: palette},
'Modus Land cover 2012');

//add elevation data
var dem = ee.Image('CGIAR/SRTM90_V4');
var elevation = dem.select('elevation');

 // clip to only your country
 var elevationclip = elevation.clip(roi)
//add to map you can play with the color pallet and the max numbers to make the varation stick out
Map.addLayer(elevationclip, {min: 0, max: 1000, palette: ['#000004', '#50127b', '#b63679', '#fc8761', '#fdfd65']}, 'Elevation');
# PRESENTING CODE
  
//call landcover Modis

var modisLandcover = ee.ImageCollection('MODIS/061/MCD12Q1');

//call country boundary file

var countries = ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017")

// Load a country border to a region of interest (roi).These are recognized boardings of the USA

var roi = countries.filterMetadata('country_na', 'equals', 'Netherlands');

//center the map on the coutnry identified by the ROI

Map.centerObject(roi);

//Call Modis land cover dataset

//filter Modis landcover by date - check the datapage for possible date ranges
var filtered = modisLandcover.filter(
  ee.Filter.date('2012-01-01', '2012-12-31'))

//landcover for the year 2019
var landcover2019 = ee.Image(filtered.first())
//classify data based on land class type 1 
var classified = landcover2019.select('LC_Type1')

// clip to only your country
 var roiLandcover = classified.clip(roi)

 
 //color palette for the classification - this matches the Modus official color pallet but feel free to play here
var palette = ['05450a', '086a10', '54a708',
 '78d203', '009900', 'c6b044','dcd159', 
 'dade48', 'fbff13', 'b6ff05', '27ff87',
 'c24f44', 'a5a5a5', 'ff6d4c', '69fff8',
 'f9ffa4', '1c0dff']

//Call Corine landuse cover

var dataset2 = ee.Image('COPERNICUS/CORINE/V20/100m/2012');


//there are multiple datasets or classes in the above called data - specifiy which one you want in this case pick landcover
var Cor_landCover = dataset2.select('landcover');

//the dataset is global so select your ROI to clip the dataset - save energy and focus your users attention
var landcoverClip = Cor_landCover.clip(roi);

//render land use data on the map - only call your country/ROI which you clipped above- the string land cover is the label you will see in the layer name

Map.addLayer(landcoverClip, {}, 'Cor_landCover');


//add the visualized modis data to the map and label name landcover 2019 the entire world
Map.addLayer(roiLandcover,
{min:1, max:17, palette: palette},
'Modus Land cover 2012');

//add elevation data
var dem = ee.Image('CGIAR/SRTM90_V4');
var elevation = dem.select('elevation');

 // clip to only your country
 var elevationclip = elevation.clip(roi)
//add to map you can play with the color pallet and the max numbers to make the varation stick out
Map.addLayer(elevationclip, {min: 0, max: 1000, palette: ['#000004', '#50127b', '#b63679', '#fc8761', '#fdfd65']}, 'Elevation');
# PRESENTING CODE

Copy and paste this code into GEE

  • Region of interest (ROI)
  • Change the color scheme
  • Use the inspector tab to see information about a specific pixel
  • Read about and compare the different data sets -different classifications

Change the following 

// Export the elevation data from the roi - it will be exported to your google drive root directory 
Export.image.toDrive({
image: elevationclip,region: roi,
 description: 'elevation',
 scale: 30,

});
# PRESENTING CODE

Export the elevation data only - add this code to the end of the code you cut and pasted before

Made with Slides.com