I tried to do calculations for 2 dataset of EVI on different year. I got an error message evi2020.subtract is not a function. The code is below
var countries = Indonesia
var Nama_Provinsi = ['Kalimantan Selatan']
var geometry = countries.filter(ee.Filter.inList('NAME_1', Nama_Provinsi));
var area1 = ee.FeatureCollection(geometry);
var dataset = ee.ImageCollection('MODIS/006/MOD13Q1')
.filter(ee.Filter.date('2020-01-01', '2020-12-31'));
var evi2020 = dataset.select('EVI');
var eviVis = {
min: 0.0,
max: 8000.0,
palette: [
'FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901',
'66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01',
'012E01', '011D01', '011301'
],
};
Map.setCenter(116, -3, 8);
Map.addLayer(evi2020, eviVis, 'EVI20');
var dataset = ee.ImageCollection('MODIS/006/MOD13Q1')
.filter(ee.Filter.date('2010-01-01', '2010-12-31'));
var evi2010 = dataset.select('EVI');
var eviVis = {
min: 0.0,
max: 8000.0,
palette: [
'FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901',
'66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01',
'012E01', '011D01', '011301'
],
};
Map.setCenter(116, -3, 8);
Map.addLayer(evi2010, eviVis, 'EVI10');
var selisihevi = evi2020.subtract(evi2010);
Map.addLayer(selisihevi.clip(area1), {min: -0.5, max: 0.5, palette:'blue, green, yellow, red'}, "Selisih EVI");