ee.FeatureCollection.set
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
הפונקציה מחליפה מאפיין מטא-נתונים אחד או יותר של רכיב.
הפונקציה מחזירה את הרכיב עם המאפיינים שצוינו שהוחלפו.
שימוש | החזרות |
---|
FeatureCollection.set(var_args) | רכיב |
ארגומנט | סוג | פרטים |
---|
זה: element | רכיב | מופע הרכיב. |
var_args | VarArgs<Object> | מילון של מאפיינים או רצף של מאפיינים עם מספר משתנה של ארגומנטים, למשל key1, value1, key2, value2, ... |
דוגמאות
עורך הקוד (JavaScript)
// An empty FeatureCollection for simple demonstration.
var fc = ee.FeatureCollection([]);
// Set a single new property using a key-value pair.
fc = fc.set('key_1', 'value 1');
// Set multiple new properties using a series of key-value pairs.
fc = fc.set('key_2', 'value 2',
'key_3', 3);
// Set new properties using a dictionary of key-value pairs.
fc = fc.set({
key_5: ee.Array([1, 2, 3]),
key_6: ee.Image(0),
key_7: ee.Feature(null)
});
print('New FeatureCollection properties added', fc);
// Overwrite an existing property.
fc = fc.set('key_1', 'overwritten');
print('FeatureCollection property overwritten', fc);
הגדרת Python
מידע על Python API ועל שימוש ב-geemap
לפיתוח אינטראקטיבי מופיע בדף
Python Environment.
import ee
import geemap.core as geemap
Colab (Python)
from pprint import pprint
# An empty FeatureCollection for simple demonstration.
fc = ee.FeatureCollection([])
# Set a single new property using a key-value pair.
fc = fc.set('key_1', 'value 1')
# Set multiple new properties using a series of key-value pairs.
fc = fc.set('key_2', 'value 2', 'key_3', 3)
# Set new properties using a dictionary of key-value pairs.
fc = fc.set({
'key_5': ee.Array([1, 2, 3]),
'key_6': ee.Image(0),
'key_7': ee.Feature(None)
})
print('New FeatureCollection properties added:')
pprint(fc.getInfo())
# Overwrite an existing property.
fc = fc.set('key_1', 'overwritten')
print('FeatureCollection property overwritten:')
pprint(fc.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 overrides or adds metadata properties to an Element, such as a FeatureCollection.\u003c/p\u003e\n"],["\u003cp\u003eIt accepts either a dictionary of key-value pairs or a sequence of key-value pairs as arguments.\u003c/p\u003e\n"],["\u003cp\u003eExisting properties can be overwritten by calling \u003ccode\u003eset()\u003c/code\u003e with the same key and a new value.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eset()\u003c/code\u003e method returns a new Element with the modified properties, leaving the original Element unchanged.\u003c/p\u003e\n"]]],[],null,["# ee.FeatureCollection.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| FeatureCollection.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// An empty FeatureCollection for simple demonstration.\nvar fc = ee.FeatureCollection([]);\n\n// Set a single new property using a key-value pair.\nfc = fc.set('key_1', 'value 1');\n\n// Set multiple new properties using a series of key-value pairs.\nfc = fc.set('key_2', 'value 2',\n 'key_3', 3);\n\n// Set new properties using a dictionary of key-value pairs.\nfc = fc.set({\n key_5: ee.Array([1, 2, 3]),\n key_6: ee.Image(0),\n key_7: ee.Feature(null)\n});\nprint('New FeatureCollection properties added', fc);\n\n// Overwrite an existing property.\nfc = fc.set('key_1', 'overwritten');\nprint('FeatureCollection property overwritten', fc);\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\nfrom pprint import pprint\n\n# An empty FeatureCollection for simple demonstration.\nfc = ee.FeatureCollection([])\n\n# Set a single new property using a key-value pair.\nfc = fc.set('key_1', 'value 1')\n\n# Set multiple new properties using a series of key-value pairs.\nfc = fc.set('key_2', 'value 2', 'key_3', 3)\n\n# Set new properties using a dictionary of key-value pairs.\nfc = fc.set({\n 'key_5': ee.Array([1, 2, 3]),\n 'key_6': ee.Image(0),\n 'key_7': ee.Feature(None)\n})\nprint('New FeatureCollection properties added:')\npprint(fc.getInfo())\n\n# Overwrite an existing property.\nfc = fc.set('key_1', 'overwritten')\nprint('FeatureCollection property overwritten:')\npprint(fc.getInfo())\n```"]]