This is a very basic question in Google Earth Engine. I have an image converted from an ImageCollection using toBands():

Image = ee.ImageCollection(somelist.map(somefunction)).toBands()

Now I need to export this image to Asset. However, the metadata of this image only contains "type" and there is no "id". If I do


the output is null. How can I specify the id by adding this property?

3 Answers 3


The purpose of .id(), also known as the property 'system:index', is to an identify an image within the collection it came from.

You could set it on an image object, during a computation only, by setting the property named 'system:index', but there is little point in doing that, because it will not be saved to an exported asset, and if you ever put the image in a collection then it will be given a new .id().

If you want to control the asset ID of an image, which is not the same as the context-dependent identifier .id() returns, you should use the assetId parameter of Export.image.toAsset.

  • Thanks for this great answer. Your explanation makes a lot of sense for a person new to the GEE structure! Setting "system:index" will give me a new .id() (exactly what I want), while setting 'id', the 'id' will be under "property" entry. The reason I want to control the .id() is originally because I want to batch export images in one collection. I am using a batch export tool from here: users/fitoprincipe/geetools. The batch export tool actually requires .id() to automatically set the assetID. Nov 22, 2019 at 21:49
  • @pitcheverlasting Thanks for providing context! It would have been good to put that information in your question.
    – Kevin Reid
    Nov 22, 2019 at 23:28

This is simply obtained by setting the "system:index":

Image = somelist.map(function(x) x.set("system:index": something)) 

In the case of toBands(), it can be important to do it, since in absence of an image id, toBands() will add numeric indices to the band names. This can cause a conflict when exporting:

Error: Band ID "0_prcp_mean_2000_1" is invalid. Band IDs must start with a..z or A..Z and must contain only the following characters: a..z, A..Z,


It seems like band names starting with a number are not valid when exporting images as assets. Before exporting your image, you can rename the bands, prefixing them with a letter:

stack.regexpRename('^(.*)', 'b_$1')

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.