TransWikia.com

Setting value, key pair in Dictionary using Google Earth Engine JavaScript API

Geographic Information Systems Asked by balakumaran on January 25, 2021

A simple script in the Google Earth Engine code editor,

var dict = ee.Dictionary();
dict.set('num', 10);
print(dict);

gives Object (0 properties) as the output

even when i do print(dict.keys()) or print(dict.values()) it throws empty list.

How do I pass a key,value pair to a dictionary?

One Answer

you need to assign your new dictionary to an existing or new variable:

var dict = ee.Dictionary();
dict = dict.set('num', 10);
print(dict);

Correct answer by korndog on January 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP