ee.FeatureCollection.set

تتجاوز هذه السمة واحدة أو أكثر من خصائص البيانات الوصفية الخاصة بعنصر.

تعرض هذه الدالة العنصر الذي تم تجاهل خصائصه المحدّدة.

الاستخدامالمرتجعات
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 للحصول على معلومات حول واجهة برمجة التطبيقات Python واستخدام geemap للتطوير التفاعلي.

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())