0

I'm trying to get reflectance data of some points that i've gotten from another database through a Json table of pings.

I've used this code to get the data but returns only the title of columns with null reflectance values:

var rrs = ee.ImageCollection("NASA/OCEANDATA/MODIS-Aqua/L3SMI")
  .filterDate('2018-1-04', '2018-1-05')
  .select('Rrs_645', 'Rrs_555', 'Rrs_443')
  .filterBounds(geometry);

var reduceR = function(image) {
  return image.set(image.reduceRegion({
    reducer: ee.Reducer.first(),
    geometry: geometry,
 }));
};

var mRrs=rrs.map(reduceR);

Export.table.toDrive({
  collection: mRrs, 
  description: 'rrs', 
  fileNamePrefix: 'rrs', 
  fileFormat: 'CSV', 
  selectors: ['Rrs_645', 'Rrs_555','Rrs_443']
});

Thannnks

0

The problem here is that you are mapping over an image collection which returns an image collection object not a feature collection. Plus within your mapping function, you are returning an image object with the reduced data set in its properties.

Since we essentially want to convert each image to a feature with reduced data as columns, the first step would be to convert it to a list of images and map that list to process each image.

I don't have your geometry so i added a point of my own and came up with something like this.

rrs = rrs.toList(rrs.size());

var reduceR = function(image) {
  image = ee.Image(image);
  var reducedVal = image.reduceRegion({
    reducer: ee.Reducer.first(),
    geometry: geometry,
  })
  return ee.Feature(geometry).set(reducedVal);
};

var mRrs=rrs.map(reduceR);
mRrs = ee.FeatureCollection(mRrs);

Rest of the code remains same. You can view a working script here

  • Very very very thank u !!!!!!!!!! Super works ! – Caslu Avery May 1 '19 at 11:27

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.