ee.Dictionary.set
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
הגדרת ערך במילון.
שימוש | החזרות |
---|
Dictionary.set(key, value) | מילון |
ארגומנט | סוג | פרטים |
---|
זה: dictionary | מילון | |
key | מחרוזת | |
value | אובייקט | |
דוגמאות
עורך הקוד (JavaScript)
// A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
var dict = ee.Dictionary({
B1: 182,
B2: 219,
B3: 443
});
print('Set value for B3 key as -9999', dict.set('B3', -9999));
הגדרת Python
מידע על Python API ועל שימוש ב-geemap
לפיתוח אינטראקטיבי מופיע בדף
Python Environment.
import ee
import geemap.core as geemap
Colab (Python)
# A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
dic = ee.Dictionary({
'B1': 182,
'B2': 219,
'B3': 443
})
print('Set value for B3 key as -9999:', dic.set('B3', -9999).getInfo())
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-26 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-26 (שעון UTC)."],[[["\u003cp\u003eThe \u003ccode\u003eDictionary.set\u003c/code\u003e method is used to assign a new value to a specified key within an existing Earth Engine dictionary.\u003c/p\u003e\n"],["\u003cp\u003eIt accepts the dictionary, the key to be updated, and the new value as arguments.\u003c/p\u003e\n"],["\u003cp\u003eThe method returns a new dictionary with the updated key-value pair, leaving the original dictionary unchanged.\u003c/p\u003e\n"],["\u003cp\u003eThis functionality is useful for modifying data within Earth Engine dictionaries, like those containing image band values or other geospatial information.\u003c/p\u003e\n"]]],["The `Dictionary.set(key, value)` method modifies a dictionary by assigning a new value to a specified key. It takes a dictionary, a string `key`, and an `object` value as arguments, and returns the modified dictionary. The examples demonstrate setting the value of the 'B3' key to -9999 within dictionaries, using both JavaScript and Python. The key should be a String, and the value can be any object.\n"],null,["# ee.Dictionary.set\n\nSet a value in a dictionary.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|------------------------------|------------|\n| Dictionary.set`(key, value)` | Dictionary |\n\n| Argument | Type | Details |\n|--------------------|------------|---------|\n| this: `dictionary` | Dictionary | |\n| `key` | String | |\n| `value` | Object | |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).\nvar dict = ee.Dictionary({\n B1: 182,\n B2: 219,\n B3: 443\n});\n\nprint('Set value for B3 key as -9999', dict.set('B3', -9999));\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).\ndic = ee.Dictionary({\n 'B1': 182,\n 'B2': 219,\n 'B3': 443\n})\n\nprint('Set value for B3 key as -9999:', dic.set('B3', -9999).getInfo())\n```"]]