Google Earth Engine – Fixing NDVI Chart Projection Error

chart;google-earth-enginendviremote sensing

Once I multiply NDVI and EVI values with 0.0001, I get an error that is shown below. So I can't get the chart.

Error generating chart: Projection error: Unable to compute intersection of geometries in projections and .

var countries=ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017');
var Turkey=countries.filter(ee.Filter.eq('country_na','Turkey'));
var vegIndices = ee.ImageCollection('MODIS/006/MOD13A1')
                     .filterBounds(Turkey)
                     .filter(ee.Filter.date('2012-01-01', '2022-03-30'))
                     .select(['NDVI']);
print('vegIndices',vegIndices)

var ndviScaled = vegIndices.map(function(image) {
  return image.multiply(0.0001)
   .copyProperties(image, ['system:time_start','system:time_end','system:index'])
});

print('scaled_ndvi',ndviScaled)
var chart =
    ui.Chart.image
        .series({
          imageCollection: ndviScaled,
          region: Turkey,
          reducer: ee.Reducer.mean(),
          scale: 500,
          xProperty: 'system:time_start'
});
print(chart);

Best Answer

The issue is in used region. Turkey is a Feature Collection with a Multi Polygon including 25561 vertices in 4 individual Polygons. You need to find out an approach that simplifies that geometry. I'm going to use an easy way to test that it works by using Turkey bounds instead complete geometry. Code looks as follows:

var countries=ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017');
var Turkey = countries.filter(ee.Filter.eq('country_na','Turkey'));
var vegIndices = ee.ImageCollection('MODIS/006/MOD13A1')
                     .filterBounds(Turkey)
                     .filter(ee.Filter.date('2012-01-01', '2022-03-30'))
                     .select(['NDVI']);

Map.centerObject(Turkey);
Map.addLayer(Turkey);
print("Turkey", Turkey);
print("Turkey bounds", Turkey.geometry().bounds());

print('vegIndices',vegIndices);

var ndviScaled = vegIndices.map(function(image) {
  return image.multiply(0.0001)
   .copyProperties(image, ['system:time_start','system:time_end','system:index']);
});

print('scaled_ndvi',ndviScaled);
var chart =
    ui.Chart.image
        .series({
          imageCollection: ndviScaled,
          region: Turkey.geometry().bounds(),
          reducer: ee.Reducer.mean(),
          scale: 500,
          xProperty: 'system:time_start'
});
print(chart);

After running above code in GEE code editor, I got following result with produced chart for Turkey bounds (only 5 vertices):

enter image description here

Related Question