错误:
这里的时错误原始的代码链接:
https://code.earthengine.google.com/4bf0975a41e14d0c40e01925c6f3cf2a
这里主要的问题时这个单一影像不存在:
ImageCollection (Error)
ImageCollection.load: ImageCollection asset 'LANDSAT/LC08/C01/T1_SR/LC08_221077_20170411' not found (does not exist or caller does not have access).
而表面的问题是
Line 16: nir.subtract is not a function
原始代码:
var geometry = /* color: #d63000 */ee.Geometry.Point([-46.19804603400004, -12.026968211384917]);
// Importar imagem Landsat 8
//var image = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR/LC08_221077_20170411');
// Centrar mapa
Map.setCenter(-46.19804603400004,-12.026968211384917);
var image = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR').filterBounds(geometry).first();
// Obter bandas espectrais
var nir = image.select('B5'); // Infravermelho próximo
var red = image.select('B4'); // Vermelho
var blue = image.select('B2'); // Azul
var green = image.select('B3'); // Verde
// Calcular índices de vegetação
var ndvi = nir.subtract(red).divide(nir.add(red)).rename('NDVI'); // NDVI
var savi = nir.subtract(red).multiply(1.5).divide(nir.add(red).add(0.5)).rename('SAVI'); // SAVI
var evi = nir.subtract(red).multiply(2.5).divide(nir.add(red.multiply(6)).subtract(blue.multiply(7.5)).add(1)).rename('EVI'); // EVI
var wdvi = nir.subtract(red.multiply(0.87)).rename('WDVI'); // WDVI
var gndvi &