ee.List

  • The ee.List(list) function constructs a new list in Earth Engine.

  • The function takes a list of objects or a computed object as an argument and returns a List.

  • Examples in both JavaScript and Python demonstrate the usage of ee.List with various data types, including empty lists, null, booleans, numbers, strings, and nested lists.

Constructs a new list.

UsageReturns
ee.List(list)List
ArgumentTypeDetails
listList<Object>|ObjectA list or a computed object.

Examples

Code Editor (JavaScript)

print(ee.List([]));  // []
print(ee.List([null]));  // [null]
print(ee.List([true]));  // [true]
print(ee.List([1]));  // [1]
print(ee.List([ee.Number(1)]));  // [1]
print(ee.List(['a']));  // ["a"]
print(ee.List([[]]));  // [[]]
print(ee.List([ee.List([])]));  // [[]]
print(ee.List([[], [[]], [1, [], 'a']]));  // [[],[[]],[1,[],"a"]]

Python setup

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

import ee
import geemap.core as geemap

Colab (Python)

display(ee.List([]))  # []
display(ee.List([None]))  # [None]
display(ee.List([True]))  # [True]
display(ee.List([1]))  # [1]
display(ee.List([ee.Number(1)]))  # [1]
display(ee.List(['a']))  # ['a']
display(ee.List([[]]))  # [[]]
display(ee.List([ee.List([])]))  # [[]]
display(ee.List([[], [[]], [1, [], 'a']]))  # [[], [[]], [1, [], 'a']]