0

I am new in google earth engine, i am trying to plot the time series NDVI value and images as well, i found a script and i tried to modified but its not working properly. Below is the code

its giving error that, Error generating chart: The image collection is empty.

I just changed here the var geometry, and i imported the KML file using fusion table and paste the link here. How to display the statistics graph and images also for selected region

//Import GEE Feature Collection (My AOI kml)
    var geometry = ee.FeatureCollection('ft:19HmlYA6D2W-soGuCJGOvdEutyTNdZFK1tUFz2JAM');

// Create image collection of S-2 imagery for the perdiod 2016-2019
var S2 = ee.ImageCollection('COPERNICUS/S2')

//filter start and end date
.filterDate('2016-02-01', '2019-02-28')

//filter according to drawn boundary
.filterBounds(geometry);

// Function to mask cloud from built-in quality band
// information on cloud
var maskcloud1 = function(image) {
var QA60 = image.select(['QA60']);
return image.updateMask(QA60.lt(1));
};

// Function to calculate and add an NDVI band
var addNDVI = function(image) {
return image.addBands(image.normalizedDifference(['B8', 'B4']));
};

// Add NDVI band to image collection
var S2 = S2.map(addNDVI);
// Extract NDVI band and create NDVI median composite image
var NDVI = S2.select(['nd']);
var NDVImed = NDVI.median(); //I just changed the name of this variable ;)

// Create palettes for display of NDVI
var ndvi_pal = ['#d73027', '#f46d43', '#fdae61', '#fee08b', '#d9ef8b',
'#a6d96a'];

// Create a time series chart.
var plotNDVI = ui.Chart.image.seriesByRegion(S2, geometry,ee.Reducer.mean(),
'nd',500,'system:time_start', 'system:index')
              .setChartType('LineChart').setOptions({
                title: 'NDVI short-term time series',
                hAxis: {title: 'Date'},
                vAxis: {title: 'NDVI'}
});

// Display.
print(plotNDVI);

// Display NDVI results on map
Map.addLayer(NDVImed.clip(geometry), {min:-0.5, max:0.9, palette: ndvi_pal}, 'NDVI');
0

The geometry of your asset is inside the property 'geometry'. you have to tell the Earth Engine to get the geometry from that property using the argument 'column'.

//Import GEE Feature Collection (My AOI kml)
var geometry = ee.FeatureCollection('ft:19HmlYA6D2W-soGuCJGOvdEutyTNdZFK1tUFz2JAM', 'geometry');

However, reducing over such a large region will probably run into memory issues. So consider using smaller regions of interest or a larger scale. Eventually export the results.

Then it should work: link code

| improve this answer | |
-1

Well, you can create an NDVI time series via 3rd party service landviewer. In order to create a time series, you would need to:

  1. Locate an area of your interest on the map and highlight it with AOI tool enter image description here
  2. Click on “Time series analysis” icon on the toolbar on the left
  3. Set the parameters needed and hit apply. enter image description here

You are able to export this data wherever needed afterwards. Landviewer is also able to work with KML, SHP, geoJSON, CSV, WMS as well as viewing various RGB combinations and different derived products from source data - multispectral indices (as products of a higher level of processing).

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.