ee.FeatureCollection.select

اختَر مواقع من كل ميزة في مجموعة. يمكن أيضًا استدعاء هذه الدالة باستخدام وسيطات السلسلة فقط، وسيتم تفسيرها جميعًا على أنّها propertySelectors (varargs).

تعرض هذه الدالة مجموعة العناصر مع السمات المحدّدة.

الاستخدامالمرتجعات
FeatureCollection.select(propertySelectors, newProperties, retainGeometry)FeatureCollection
الوسيطةالنوعالتفاصيل
هذا: featurecollectionFeatureCollectionمثيل FeatureCollection
propertySelectorsList<String>قائمة بالأسماء أو التعبيرات العادية التي تحدّد السمات المطلوب اختيارها.
newPropertiesList<String>, اختياريقائمة بالأسماء الجديدة لسمات الإخراج. يجب أن يتطابق مع عدد المواقع المحدّدة.
retainGeometryقيمة منطقية، اختياريةعندما تكون القيمة خطأ، ستتضمّن النتيجة شكلًا هندسيًا بقيمة NULL. القيمة التلقائية هي "صحيح".

أمثلة

محرّر الرموز البرمجية (JavaScript)

// FeatureCollection of power plants in Belgium.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants')
            .filter('country_lg == "Belgium"');

// Select a single property.
var singleProp = fc.select('fuel1');
print('Single property selected',
      singleProp.first());

// Select multiple properties.
var multiProp = fc.select(['fuel1', 'capacitymw']);
print('Multiple properties selected',
      multiProp.first());

// Select multiple properties and rename them.
var multiPropRename = fc.select({
  propertySelectors: ['fuel1', 'capacitymw'],
  newProperties: ['Fuel_1', 'Capacity_MW']
});
print('Multiple properties selected, renamed',
      multiPropRename.first());

// Select multiple properties, remove geometry.
var multiPropNoGeom = fc.select({
  propertySelectors: ['fuel1', 'capacitymw'],
  retainGeometry: false
});
print('Multiple properties selected, geometry removed',
      multiPropNoGeom.first());

إعداد Python

راجِع صفحة بيئة Python للحصول على معلومات حول واجهة برمجة التطبيقات Python واستخدام geemap للتطوير التفاعلي.

import ee
import geemap.core as geemap

Colab (Python)

# FeatureCollection of power plants in Belgium.
fc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(
    'country_lg == "Belgium"')

# Select a single property.
single_prop = fc.select('fuel1')
print('Single property selected:', single_prop.first().getInfo())

# Select multiple properties.
multi_prop = fc.select(['fuel1', 'capacitymw'])
print('Multiple properties selected:', multi_prop.first().getInfo())

# Select multiple properties and rename them.
multi_prop_rename = fc.select(**{
    'propertySelectors': ['fuel1', 'capacitymw'],
    'newProperties': ['Fuel_1', 'Capacity_MW']
    })
print('Multiple properties selected, renamed:',
      multi_prop_rename.first().getInfo())

# Select multiple properties, remove geometry.
multi_prop_no_geom = fc.select(**{
    'propertySelectors': ['fuel1', 'capacitymw'],
    'retainGeometry': False
    })
print('Multiple properties selected, geometry removed:',
      multi_prop_no_geom.first().getInfo())