I am trying to convert ASTER image from DN values to reflectance. For this I require gain coefficient of each image in the collection I have gathered.

//Defining geometry
var geometry = ee.Geometry.Polygon([[72.8,29.8], [74.7,28.27], [77.6,30.1], [75.6,31.6], [72.8,29.8]]);

//Creating collection
var collection = ee.ImageCollection('ASTER/AST_L1T_003')
    .filterMetadata('CLOUDCOVER', 'less_than', 2)
    //.filterDate('2004-01-01', '2004-03-28')
print('Collection: ', collection);
//Filtering data for specific day of year
var collection_121_134 = collection.filter(ee.Filter.dayOfYear(121,134));

Now this collection_121_134 contains 59 elements (i.e. 59 image tiles). For each tile I want to access its gain coefficient value which is found in: Collection>>features( total no of tiles)>>any tile selected>>properties>>'GAIN_COEFFICIENT_B01'.

Please suggest a method through which I can access this information, which will help me in converting the images to their reflectance values.

  • 1
    I think you should keep reading developers.google.com/earth-engine Feb 21, 2018 at 13:58
  • If you .map() over a collection you can access the metadata with .get() (in your case .get("GAIN_COEFFICIENT_B01")). All you need to do is create a function to calculate the reflectance and then use map to apply it to every image in the collection.
    – Kersten
    Feb 21, 2018 at 15:27

1 Answer 1


If you want to add a calculated value as a new property to the image, then follow Kersten's advice, which is something along the lines of:

collection_121_134 = collection_121_134.map(function(img) {
    var gain = img.get('GAIN_COEFFICIENT_B01');
    var reflect = .......;
    img = img.set('Reflectance', reflect);

If all you want is to extract a property from each image, you can use aggregate_array(), as in:

var gains = collection_121_134.aggregate_array('GAIN_COEFFICIENT_B01');

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.