Announcement: All noncommercial projects registered to use Earth Engine beforeApril 15, 2025 mustverify noncommercial eligibility to maintain access. If you have not verified by September 26, 2025, your access may be on hold.

ee.ImageCollection.set

  • Theset method overrides one or more metadata properties of an Element and returns the element with the specified properties overridden.

  • Theset method can take either a dictionary of properties or a sequence of key-value pairs as arguments.

  • Examples demonstrate how to use theset method to set properties on anee.ImageCollection using both a dictionary and key-value pairs in both JavaScript and Python.

  • The examples also show how to retrieve the set properties using methods liketoDictionary,get,getString,getNumber, andgetArray.

Overrides one or more metadata properties of an Element.

Returns the element with the specified properties overridden.

UsageReturns
ImageCollection.set(var_args)Element
ArgumentTypeDetails
this:elementElementThe Element instance.
var_argsVarArgs<Object>Either a dictionary of properties, or a vararg sequence of properties, e.g. key1, value1, key2, value2, ...

Examples

Code Editor (JavaScript)

// A contrived, empty image collection for simple demonstration.varcol=ee.ImageCollection([]);print('Collection without properties',col);// Set collection properties using a dictionary.col=col.set({project_name:'biomass_tracking',project_id:3,plot_ids:ee.Array([7,11,20])});// Set collection properties using a series of key-value pairs.col=col.set('project_year',2018,'rgb_vis','false_color');print('Collection with properties',col);// Get a dictionary of collection property keys and values.print('Property keys and values (ee.Dictionary)',col.toDictionary());// Get the value of a collection property. To use the result of// ee.ImageCollection.get in further computation, you need to cast it to the// appropriate class, for example, ee.Number(result) or ee.String(result).print('Project ID (ambiguous object)',col.get('project_id'));// Get the value of a string collection property as an ee.String object.print('Project name (ee.String)',col.getString('project_name'));// Get the value of a numeric collection property as an ee.Number object.print('Project year (ee.Number)',col.getNumber('project_year'));// Get the value of an ee.Array collection property as an ee.Array object.print('Plot IDs (ee.Array)',col.getArray('plot_ids'));

Python setup

See the Python Environment page for information on the Python API and usinggeemap for interactive development.

importeeimportgeemap.coreasgeemap

Colab (Python)

# A contrived, empty image collection for simple demonstration.col=ee.ImageCollection([])display('Collection without properties:',col)# Set collection properties using a dictionary.col=col.set({'project_name':'biomass_tracking','project_id':3,'plot_ids':ee.Array([7,11,20])})# Set collection properties using a series of key-value pairs.col=col.set('project_year',2018,'rgb_vis','false_color')display('Collection with properties:',col)# Get a dictionary of collection property keys and values.display('Property keys and values (ee.Dictionary):',col.toDictionary())# Get the value of a collection property. To use the result of# ee.ImageCollection.get in further computation, you need to cast it to the# appropriate class, for example, ee.Number(result) or ee.String(result).display('Project ID (ambiguous object):',col.get('project_id'))# Get the value of a string collection property as an ee.String object.display('Project name (ee.String):',col.getString('project_name'))# Get the value of a numeric collection property as an ee.Number object.display('Project year (ee.Number):',col.getNumber('project_year'))# Get the value of an ee.Array collection property as an ee.Array object.display('Plot IDs (ee.Array):',col.getArray('plot_ids'))

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-08 UTC.