TransWikia.com

How to get property of each image in a collection in google earth engine?

Geographic Information Systems Asked by Apurva Alok on April 16, 2021

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')
    .filterBounds(geometry)
    .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.

One Answer

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);
    return(img)
});

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');

Answered by filups21 on April 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP