After filter OLI8 for a small area

var collectionFilter = ee.ImageCollection('LANDSAT/LC08/C01/T1_RT_TOA')

And add NDVI band

var app = function (image)
//indice de vegetação
var ndvi = image.normalizedDifference(['B5', 'B4']);
image=image.addBands (ndvi.rename('NDVI'));

  return image

I generate a chart using a click function and try to export as JSON format the values.

  var pixel = ee.Geometry.Point([lonlat.lon, lonlat.lat])
  var collection = collectionFilter
    var options = {
        title : 'NDVI CHART VALUES'

    var graph = (


    collection: collection,
    description:  'exporting in json format each click',
    fileFormat: 'JSON'


But doesnt work. How can I do this? Here is the link code

1 Answer 1


The ui.Chart.image.series function works very well in visualizing rapidly pixel values at a certain point, but it outputs a chart which you cannot export using Export.table.toDrive. At the moment, you are trying to export a imageCollection as a table, what is probably not wat you want.

To get the NDVI values corresponding to the pixel [lat,lon] you clicked, you first have to use reduceRegion(s). Then you get the pixel information of a geometry.

  // make a feature collection (which you can export)
  var featureCollection = collection.map(function(image){
    return image.reduceRegions({collection: pixel, scale: 30, reducer: ee.Reducer.mean()})
    // Map over the new feature collection to add the system:time_start of the image
      return feat.set('system:time_start', image.get('system:time_start'));

Then you can export that collection to you drive. Note that the format is GeoJSON and that you cannot use spaces in the name

    collection: featureCollection,
    description:  'exporting_in_json_format_each_click',
    fileFormat: 'GeoJSON'

Note that I took the liberty to make you collection filter in such a way that it filters the collection on the point you clicked, so it should work anywhere around the world (as long as there are image present). Link code

  • Thanks to share the knowledge. Commented Jun 25, 2019 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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