In previous codes I was able to generate the NDVI average, but since NDDI is a sub-index I would like to know if anyone would be able to generate this NDDI average in GEE


var ceara = ee.FeatureCollection("users/felipeherminio8/Estados_Nordeste/Ceara"),
    semi = ee.FeatureCollection("users/felipeherminio8/semiarido_SIMPLIFICADO");

var l8 = ee.ImageCollection('LANDSAT/LC08/C01/T1_RT');

var L8Filtered = l8.filterDate('2013-01-01', '2013-12-31').filter(ee.Filter.lt('CLOUD_COVER', 70));
var l8_Composite= ee.Algorithms.Landsat.simpleComposite({
collection: L8Filtered, asFloat: true});

var ndvi = l8_Composite.normalizedDifference(['B5', 'B4']).rename('NDVI');
var ndwi = l8_Composite.normalizedDifference(['B5', 'B6']).rename('NDWI');
var nddi = (ndvi.subtract(ndwi)).divide((ndvi.add(ndwi)));

var index = index.map(nddi);
var nddis = index.select(['NDVI']);
var nddimed = nddis.median(); 

var visParams = {bands: ['B4', 'B3', 'B2'], };
Map.addLayer(l8_Composite.clip(semi), visParams, 'Mosaico L8');
Map.addLayer(nddi.clip(semi), {min: -15, max: 15,palette:['black', 'blue', 'purple', 'cyan', 'green', 'yellow', 'red']},'NDDI L8');
Map.addLayer(ndvi.clip(semi), {palette:['black', 'blue', 'purple', 'cyan', 'green', 'yellow', 'red']},'NDVI L8');
Map.addLayer(ndwi.clip(semi), {palette:['black', 'blue', 'purple', 'cyan', 'green', 'yellow', 'red']},'NDWI L8');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.