1

I have calculated the mean , mode, median of all bands of an image.

Now I want to display the result as a table in .csv, as shown in example output: table I want as result

I tried following code, which is also on Google's Cloud IDE, Earth Engine (EE) Code Editor:

// Extract the bands from collection and make a list
var bands= ee.List([
                    [ 'B1','0.45','0.092377477','0.086616925','0.086616925'],
                     ['B2','0.51','0.085137095','0.076246974','0.076246974'],
                     ['B3','0.59','0.062736553','0.053236987','0.044920224'],
                     ['B4','0.67','0.324248892','0.334150672','0.357299032'],
                     ['B5','0.88','0.161820343','0.157588621','0.153408903'],
                     ['B6','1.65','0.3812067','0.295290527','293.7689209'],
                     ['B7','2.29','0.076728936','0.064302692','0.052958585'],
                     ['B8','0.5','672.0124447','671','672']]);

var featList=bands.map(function(list){
  return ee.Feature(null).set({bands:ee.List(list).get(0),wavelength:ee.List(list).get(1),
      mean:ee.List(list).get(2),median:ee.List(list).get(3),mode:ee.List(list).get(4)})
})
var features = ee.FeatureCollection(featList)
print(features)

I am told to display the result using a for loop. I cannot understand how to use the loop here.

hc_dev
  • 8,389
  • 1
  • 26
  • 38

0 Answers0