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.Dictionary.fromLists

  • Create anee.Dictionary from two parallel lists usingee.Dictionary.fromLists(keys, values).

  • The function takes a list of keys and a list of values as arguments.

  • It returns a Dictionary object.

  • Examples are provided for both JavaScript and Python environments.

Construct a dictionary from two parallel lists of keys and values.

UsageReturns
ee.Dictionary.fromLists(keys, values)Dictionary
ArgumentTypeDetails
keysListA list of keys.
valuesListA list of values.

Examples

Code Editor (JavaScript)

// Corresponding lists of keys and values.varkeys=['B1','B2','B3'];varvalues=[182,219,443];print('Dictionary from lists of keys and values',ee.Dictionary.fromLists(keys,values));

Python setup

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

importeeimportgeemap.coreasgeemap

Colab (Python)

# Corresponding lists of keys and values.keys=['B1','B2','B3']values=[182,219,443]display('Dictionary from lists of keys and values:',ee.Dictionary.fromLists(keys,values))

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 2024-07-13 UTC.