4

the console gives me a view into the 'properties' of the ImageCollection object:

ImageCollection LANDSAT/LC08/C01/T1_SR (107 elements)
type: ImageCollection
id: LANDSAT/LC08/C01/T1_SR
version: 1524816484446982
bands: []
features: List (107 elements)
properties: Object (23 properties)

and the docs describe methods to access the properties of the properties object.

problem: how do I read the features list? I want the 'id' property of each of the images (which the console can show me). I have tried:

var imageList = myImageCollection.toList(100).features;

and the error is: Cannot read property '0' of undefined

hoping for an undocumented method, I tried:

var imageList = myImageCollection.features();

and the error is: myImageCollection.features is not a function

1 Answer 1

8

You can access the ID of an image using ee.Image.id(). For example:

var geometry = ee.Geometry.Point([-112.62, 40.98]);

var myImageCollection = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
  .filterBounds(geometry);

// Create a list of image objects.
var imageList = myImageCollection.toList(100);
print('imageList', imageList);

// Extract the ID of each image object.
var id_list = imageList.map(function(item) {
  return ee.Image(item).id();
});
print('id_list', id_list);
2
  • thank you, Tyler. (as one of the ee training audience members said, maybe this is an opportunity for more API sugar?)
    – Cord
    May 2, 2018 at 4:38
  • Thank you for accepting my post here. I am trying to filter out all stripping artifact bands in Landsat 5 surface reflectance for my study area, but I can't filter them automatically. Please help me, here is my code [here][1]. [1]: code.earthengine.google.com/ea4af1ee892e750a5d659850573b4af2
    – Tuyen
    Apr 14, 2020 at 17:27

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.