ee.FeatureCollection.set
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ลบล้างพร็อพเพอร์ตี้ข้อมูลเมตาอย่างน้อย 1 รายการขององค์ประกอบ
แสดงผลองค์ประกอบที่มีการลบล้างพร็อพเพอร์ตี้ที่ระบุ
การใช้งาน | การคืนสินค้า |
---|
FeatureCollection.set(var_args) | องค์ประกอบ |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
ดังนี้ element | องค์ประกอบ | อินสแตนซ์ขององค์ประกอบ |
var_args | VarArgs<Object> | พจนานุกรมของพร็อพเพอร์ตี้ หรือลำดับ vararg ของพร็อพเพอร์ตี้ เช่น 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
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())
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 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```"]]