ee.FeatureCollection.select

Выберите свойства из каждого Feature в коллекции. Также возможно вызвать эту функцию только с аргументами-строками; все они будут интерпретироваться как propertySelectors (varargs).

Возвращает коллекцию объектов с выбранными свойствами.

Использование Возвраты
FeatureCollection. select (propertySelectors, newProperties , retainGeometry ) FeatureCollection
Аргумент Тип Подробности
это: featurecollection FeatureCollection Экземпляр FeatureCollection.
propertySelectors Список<Строка> Список имен или регулярных выражений, указывающих атрибуты для выбора.
newProperties Список<Строка>, необязательно Список новых имен для выходных свойств. Должен соответствовать количеству выбранных свойств.
retainGeometry Булево, необязательно Если false, результат будет иметь геометрию NULL. По умолчанию true.

Примеры

Редактор кода (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

Информацию об API Python и использовании geemap для интерактивной разработки см. на странице Python Environment .

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