ee.ImageCollection.set
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
הפונקציה מחליפה מאפיין מטא-נתונים אחד או יותר של רכיב.
הפונקציה מחזירה את הרכיב עם המאפיינים שצוינו שהוחלפו.
שימוש | החזרות |
---|
ImageCollection.set(var_args) | רכיב |
ארגומנט | סוג | פרטים |
---|
זה: element | רכיב | מופע הרכיב. |
var_args | VarArgs<Object> | מילון של מאפיינים או רצף של מאפיינים עם מספר משתנה של ארגומנטים, למשל key1, value1, key2, value2, ... |
דוגמאות
עורך הקוד (JavaScript)
// A contrived, empty image collection for simple demonstration.
var col = 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
מידע על Python API ועל שימוש ב-geemap
לפיתוח אינטראקטיבי מופיע בדף
Python Environment.
import ee
import geemap.core as geemap
Colab (Python)
# A contrived, empty image collection for simple demonstration.
col = ee.ImageCollection([])
print('Collection without properties:', col.getInfo())
# 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.getInfo())
# Get a dictionary of collection property keys and values.
print('Property keys and values (ee.Dictionary):', col.toDictionary().getInfo())
# 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').getInfo())
# Get the value of a string collection property as an ee.String object.
print('Project name (ee.String):', col.getString('project_name').getInfo())
# Get the value of a numeric collection property as an ee.Number object.
print('Project year (ee.Number):', col.getNumber('project_year').getInfo())
# Get the value of an ee.Array collection property as an ee.Array object.
print('Plot IDs (ee.Array):', col.getArray('plot_ids').getInfo())
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-25 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-25 (שעון UTC)."],[[["\u003cp\u003eThe \u003ccode\u003eset()\u003c/code\u003e method allows you to override metadata properties of an Element, such as an ImageCollection, using either a dictionary or key-value pairs.\u003c/p\u003e\n"],["\u003cp\u003eIt returns a new Element with the updated properties, leaving the original Element unchanged.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve property values using methods like \u003ccode\u003eget()\u003c/code\u003e, \u003ccode\u003egetString()\u003c/code\u003e, \u003ccode\u003egetNumber()\u003c/code\u003e, and \u003ccode\u003egetArray()\u003c/code\u003e, and the \u003ccode\u003etoDictionary()\u003c/code\u003e method provides all properties as a dictionary.\u003c/p\u003e\n"],["\u003cp\u003eWhen using \u003ccode\u003eget()\u003c/code\u003e to retrieve a property value, it's crucial to cast the result to the appropriate data type (e.g., ee.Number, ee.String) for use in further computations.\u003c/p\u003e\n"]]],[],null,["# ee.ImageCollection.set\n\n\u003cbr /\u003e\n\nOverrides one or more metadata properties of an Element.\n\n\u003cbr /\u003e\n\nReturns the element with the specified properties overridden.\n\n| Usage | Returns |\n|---------------------------------|---------|\n| ImageCollection.set`(var_args)` | Element |\n\n| Argument | Type | Details |\n|-----------------|-------------------|-------------------------------------------------------------------------------------------------------------|\n| this: `element` | Element | The Element instance. |\n| `var_args` | VarArgs\\\u003cObject\\\u003e | Either a dictionary of properties, or a vararg sequence of properties, e.g. key1, value1, key2, value2, ... |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// A contrived, empty image collection for simple demonstration.\nvar col = ee.ImageCollection([]);\nprint('Collection without properties', col);\n\n// Set collection properties using a dictionary.\ncol = col.set({\n project_name: 'biomass_tracking',\n project_id: 3,\n plot_ids: ee.Array([7, 11, 20])\n});\n\n// Set collection properties using a series of key-value pairs.\ncol = col.set('project_year', 2018,\n 'rgb_vis', 'false_color');\n\nprint('Collection with properties', col);\n\n// Get a dictionary of collection property keys and values.\nprint('Property keys and values (ee.Dictionary)', col.toDictionary());\n\n// Get the value of a collection property. To use the result of\n// ee.ImageCollection.get in further computation, you need to cast it to the\n// appropriate class, for example, ee.Number(result) or ee.String(result).\nprint('Project ID (ambiguous object)', col.get('project_id'));\n\n// Get the value of a string collection property as an ee.String object.\nprint('Project name (ee.String)', col.getString('project_name'));\n\n// Get the value of a numeric collection property as an ee.Number object.\nprint('Project year (ee.Number)', col.getNumber('project_year'));\n\n// Get the value of an ee.Array collection property as an ee.Array object.\nprint('Plot IDs (ee.Array)', col.getArray('plot_ids'));\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 contrived, empty image collection for simple demonstration.\ncol = ee.ImageCollection([])\nprint('Collection without properties:', col.getInfo())\n\n# Set collection properties using a dictionary.\ncol = col.set({\n 'project_name': 'biomass_tracking',\n 'project_id': 3,\n 'plot_ids': ee.Array([7, 11, 20])\n})\n\n# Set collection properties using a series of key-value pairs.\ncol = col.set('project_year', 2018,\n 'rgb_vis', 'false_color')\n\nprint('Collection with properties:', col.getInfo())\n\n# Get a dictionary of collection property keys and values.\nprint('Property keys and values (ee.Dictionary):', col.toDictionary().getInfo())\n\n# Get the value of a collection property. To use the result of\n# ee.ImageCollection.get in further computation, you need to cast it to the\n# appropriate class, for example, ee.Number(result) or ee.String(result).\nprint('Project ID (ambiguous object):', col.get('project_id').getInfo())\n\n# Get the value of a string collection property as an ee.String object.\nprint('Project name (ee.String):', col.getString('project_name').getInfo())\n\n# Get the value of a numeric collection property as an ee.Number object.\nprint('Project year (ee.Number):', col.getNumber('project_year').getInfo())\n\n# Get the value of an ee.Array collection property as an ee.Array object.\nprint('Plot IDs (ee.Array):', col.getArray('plot_ids').getInfo())\n```"]]