とらりもんHOME  Index  Search  Changes  Login

Google Earth Engine

2017/08/18 Jin Katagi: Add Tips parts.

What is Google Earth Engine ?

紹介ビデオ (introduction movie): https://www.youtube.com/watch?v=Hr3F0s9oKwQ

アカウント作成 (How to make your account): https://docs.google.com/forms/d/17-LSoJQcBUGIwfplrBFLv0ULYhOahHJs2MwRF2XkrcM/viewform

See Get Started first.

Tips

Collect cloud free image

Filtering and Sorting slightly modified.

// set the conter of your area of intrest (Near the Tsukuva city).
var point = ee.Geometry.Point(140.1217, 36.1101);

// construct start and end dates
var start = ee.Date('2014-06-01');
var finish = ee.Date('2014-10-01');

var filteredCollection = ee.ImageCollection('LANDSAT/LC8_L1T')
  .filterBounds(point)
  .filterDate(start, finish)
  .sort('CLOUD_COVER', true);
  
// Get the lowest cloud cover image.
var first = filteredCollection.first();
var image = ee.Image(first);

// Define visualizatoin parameters in an object literal.
var vizParams = {bands: ['B4', 'B3', 'B2'], min: 5000, max: 15000, gamma: [0.95, 1.1, 1]};
  
// Center the map on the image and display.
Map.centerObject(image, 9);
Map.addLayer(image, vizParams, 'Landsat 8 true color');

Get image center

// Load Landsat 5 image
var image1 = ee.Image('LT5_L1T_TOA/LT50440341990155XXX03');
// In case you want to know the value of the center latitude and logitude of the image.
print(Map.getCenter(image1));
// In case you just want to set center.
Map.centerObject(image1, 9); 

Calculate NDVI difference at two time periods

Referred Color palettes and Band math.

// This function gets NDVI from Landsat 5 imagery.
var getNDVI = function(image) {
  return image.normalizedDifference(['B4', 'B3']);
};

// Load two Landsat 5 images, 20 years apart.
var image1 = ee.Image('LT5_L1T_TOA/LT50440341990155XXX03'); // 1990-06-04
var image2 = ee.Image('LT5_L1T_TOA/LT50440342010162EDC00'); // 2010-06-11

// Compute NDVI from the scenes.
var ndvi1 = getNDVI(image1);
var ndvi2 = getNDVI(image2);

// Compute the difference in NDVI.
var ndviDifference = ndvi2.subtract(ndvi1);
// set the color palette. 0:Blue, 1:Red.
var ndviViz = {min: 0, max: 1, palette: ['0000FF', 'FF0000']};

// Center the map on the image and display.
Map.centerObject(ndviDifference, 9);
Map.addLayer(ndviDifference, ndviViz, 'NDVI Difference');

Memo

よく使うコマンド

  • Map.centerObject(image) : 画像を表示の中心に合わせる
  • Map.addLayer(image,zoomLevel) : 画像を表示
Last modified:2017/08/18 14:50:17
Keyword(s):
References:[とらりもんHOME]