ee.FeatureCollection.set

ลบล้างพร็อพเพอร์ตี้ข้อมูลเมตาอย่างน้อย 1 รายการขององค์ประกอบ

แสดงผลองค์ประกอบที่มีการลบล้างพร็อพเพอร์ตี้ที่ระบุ

การใช้งานการคืนสินค้า
FeatureCollection.set(var_args)องค์ประกอบ
อาร์กิวเมนต์ประเภทรายละเอียด
ดังนี้ elementองค์ประกอบอินสแตนซ์ขององค์ประกอบ
var_argsVarArgs<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())