ee.FeatureCollection.select

בוחרים מאפיינים מכל תכונה באוסף. אפשר גם לקרוא לפונקציה הזו רק עם ארגומנטים של מחרוזות. כולם יפורשו כ-propertySelectors (מספר משתנה של ארגומנטים).

הפונקציה מחזירה את אוסף הישויות עם המאפיינים שנבחרו.

שימושהחזרות
FeatureCollection.select(propertySelectors, newProperties, retainGeometry)FeatureCollection
ארגומנטסוגפרטים
this: featurecollectionFeatureCollectionהמכונה של FeatureCollection.
propertySelectorsList[String]‎רשימה של שמות או ביטויים רגולריים שמציינים את המאפיינים שצריך לבחור.
newPropertiesרשימה[מחרוזת], אופציונלירשימה של שמות חדשים למאפייני הפלט. חייב להתאים למספר הנכסים שנבחרו.
retainGeometryערך בוליאני, אופציונליכשהערך הוא False, התוצאה תהיה גיאומטריה מסוג NULL. ערך ברירת המחדל הוא true.

דוגמאות

Code Editor (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 מפורט מידע על API בשפת 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')
display('Single property selected:', single_prop.first())

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

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

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