After filter an LANDSAT-05 for an small area

  var Collection = function(pixel) {
  var colForPixel = ee.ImageCollection('LANDSAT/LM05/C01/T1')
  return colForPixel;


Add NDVI and EVI2 to this collection filtered

var app = function (image) {
  var ndvi = image.normalizedDifference(['B5', 'B4']);
  image=image.addBands (ndvi.rename('NDVI'));

  var evi2 =  image.expression("2.5 * ((NIR - RED) / (NIR + (2.4 * RED) + 1))",{
    'NIR': image.select('B5')

  image = image.addBands(evi2.rename('EVI2'));
  return image;

I ploted an chart, using a click point function

  var pixel = ee.Geometry.Point([lonlat.lon, lonlat.lat]);
  var collection = Collection(pixel)
.select(["NDVI"], ["NDVI"])
.merge(Collection.select(["EVI2"], ["EVI2"])
  var options = {title : 'NDVI/ EVI2 CHART VALUES'};
   var graph = (
    ui.Chart.image.series(collection,pixel,ee.Reducer.mean(), 30

Then, I create a function to reduce each feature

// 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(function(feat){
      return feat.set('system:time_start', image.get('system:time_start'));

Then, to could export as GeoJSON, I separated the featureCollection into two lists: one from NDVI values, and another to EVI2 values

//Firts, transform the bigger FeatureCollection in to a lis and get the size
var featureCollectionList = featureCollection.toList(featureCollection.size())

//filter NDVI values
var ndviFilter = featureCollectionList.slice(0,ee.Number(featureCollectionList.size()).divide(2))
ndviFilter = ee.FeatureCollection(ndviFilter)

//filter EVI2 values
var evi2Filter = featureCollectionList.slice(ee.Number(featureCollectionList.size()).divide(2),ee.Number(featureCollectionList.size()))
evi2Filter = ee.FeatureCollection(evi2Filter)

Applying an simple join method

// Use an equals filter to define how the collections match.
var filter = ee.Filter.equals({
  leftField: 'id',
  rightField: 'id'

// Create the join.
var simpleJoin = ee.Join.simple();

// Apply the join.
var simpleJoined = simpleJoin.apply(ndviFilter, evi2Filter, filter);

// Display the result.
print('Simple join: ', simpleJoined);

And, finally, export, but doesn't seems to work

    collection: simpleJoined,
    description:  'exporting as GeoJSON, with two differents columns (one to EVI2 and, another, one to NDVI)',
    fileFormat: 'JSON'


Here is the source code link

1 Answer 1


There are a few issues but for the most part the code seems to be fine. First of all, you are trying to use LandSat 5 MSS Raw scenes which has two problems

  1. There is no image in that collection for your location
  2. You are using B5 for NIR band and B4 for Red which should be B3 and B2 instead.

Assuming you were not actually going for Landsat 5 MSS scenes, you might be looking to use Landsat 5 scenes such as "LANDSAT/LT05/C01/T1_SR". This is the surface reflectance tier 1 collection but there are raw scenes as well if you want those.

Another thing is that you are filtering Collection object as a function??? which you are not calling and just printing it out. You want to do this instead which gave 28 images.

var Collection = LT05 //the name of the image collection object


Finally, in your export section, the description is not a short description but actually what appears on the tasks to help you identify which is which and it does not accept spaces. So it can be something like below. Also, the "JSON" file format is not supported and it needs to be GeoJSON. But, this two things can be changed while starting the export as well.

    collection: simpleJoined,
    description:  'export_geojson_with_ndvi_evi2',
    fileFormat: 'GeoJSON'

Here is a working version. The export is added to tasks when map is clicked somewhere.

  • Thanks to identify my mistakes, congrats Commented Jun 26, 2019 at 11:37

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.