I am trying to export some vegetation condition index data calculated from MODIS data on Google Earth Engine to a table, but keep getting the error:
Error in map(ID=3): Image.reduceRegions: Unable to transform geometry into projection <Projection>
This is the code I am using. The error seems to be occurring where I am exporting the data to a table (the lines at the end of this code block), as the rest of the code works well. The variable "mariupol" is a shapefile feature I uploaded to GEE and is in WGS 84 projection
Map.addLayer(mariupol);
//
//calculate average monthly NDVI for Mariupol
//get MODIS NDVI
var collection = ee.ImageCollection('MODIS/006/MOD13A1').select('NDVI');
// Reference period for baseline NDVI
var reference = ee.ImageCollection(collection.filterDate('2001-01-01', '2020-12-31'))
.sort('system:time_start');
print("reference",reference);
//filter out images from march, april, may (spring)
var spring = reference.filter(ee.Filter.dayOfYear(59,150));
//calulate min of full series (mam 2001-2020) for each pixel
var spring_min = spring.min();
//calculate max of full series (mam 2001-2020) for each pixel
var spring_max = spring.max();
var vci_bot = spring_max.subtract(spring_min);
//iterate through months and calculate average Vegetation condition Index
var years = ee.List.sequence(2001, 2020);
print("years",years);
var byYear = ee.ImageCollection.fromImages(
years.map(function (y) {
return spring.filter(ee.Filter.calendarRange(y, y, 'year'))
.select(("NDVI")).mean()
.subtract(spring_min)
.divide(vci_bot)
.set('year', y);
}));
print("byYear",byYear);
//Define chart parameters
var chartParam = {
title: 'Average VCI (spring), mariupol',
hAxis: {title: 'Time'},
vAxis: {title: 'Average VCI'},
};
//Plot the chart
var chart = ui.Chart.image.seriesByRegion({
imageCollection: byYear,
regions: mariupol.getInfo(),
reducer: ee.Reducer.mean(),
scale: 500,
xProperty: 'year',
seriesProperty: 'PROJECT'
});
//Print chart to console
print(chart.setOptions(chartParam));
var spring_vci_mariupol = byYear.filterBounds(mariupol);
//get means as table and add to Drive
var spring_vci_means = byYear.map(function(image){
return image.reduceRegions({
collection:spring_vci_mariupol,
reducer:ee.Reducer.mean(),
scale: 30
});
});
var table2 = spring_vci_means.flatten();
print(table2);
Export.table.toDrive(table2,"spring_vci_means_mariupol");