Geographic Information Systems Asked by iqbalhabibie habibie on February 17, 2021
I am reading the example in Google Earth Engine was many using the Image Collection but I can’t find a single scene reading the image so I am trying to calculate for single scene using Landsat 8 OLI for 09 January 2019 but have a problem reading the scene then calculate NDVI from single scene, this is the script :
var tuban = ee.FeatureCollection("users/iqbal/Tuban");
var image = ee.Image('LANDSAT/LC08/C01/T1/LC08_L1TP_119065_20190109_20190130_01_T1')
// Get information about the bands as a list.
var bandNames = image.bandNames();
print('Band names: ', bandNames); // ee.List of band names
// Get projection information from band 1.
var b1proj = image.select('B1').projection();
print('Band 1 projection: ', b1proj); // ee.Projection object
// Get scale (in meters) information from band 1.
//var b1scale = image.select('B1').projection().nominalScale();
//print('Band 1 scale: ', b1scale); // ee.Number
// create function to add NDVI using NIR (B5) and the red band (B4)
var getNDVI = function(img){
return img.addBands(img.normalizedDifference(['B5','B4']).rename('NDVI'));
};
// map over image collection
var l8ndvi = image.map(getNDVI);
var composite = l8ndvi.qualityMosaic('NDVI').clip(tuban);
print(composite);
// Visualize NDVI
var ndviPalette = ['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718',
'74A901', '66A000', '529400', '3E8601', '207401', '056201',
'004C00', '023B01', '012E01', '011D01', '011301'];
Map.addLayer(composite.select('NDVI'),
{min:0, max: 1, palette: ndviPalette}, 'ndvi');
There is some error for accessing the single scene like this:
Band names:
List (Error)
Image.load: Image asset 'LANDSAT/LC08/C01/T1/LC08_L1TP_119065_20190109_20190130_01_T1' not found.
Band 1 projection:
Projection (Error)
Image.load: Image asset 'LANDSAT/LC08/C01/T1/LC08_L1TP_119065_20190109_20190130_01_T1' not found.
image.map is not a function
``
Any suggestions as a solution for this?
The naming convention you've used is mixture of google earth engine and Landsat documentation.
Landsat uses the following naming convention
LXSS_LLLL_PPPRRR_YYYYMMDD_yyyymmdd_CC_TX
read about it here
while in google earth engine you do not specify the Processing year, month, day or collection number. The convention in GEE is
LANDSAT/LXSS/C01/TX/LXSS_PPPRRR_YYYYMMDD
another error: image.map is not a function
is because mapping is done over image collection not a single image
Answered by aman jain on February 17, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP