ee.FeatureCollection.select
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Wybierz usługi z każdej funkcji w kolekcji. Można też wywołać tę funkcję tylko z argumentami w postaci ciągów znaków. Wszystkie będą interpretowane jako propertySelectors (varargs).
Zwraca kolekcję obiektów z wybranymi właściwościami.
Wykorzystanie | Zwroty |
---|
FeatureCollection.select(propertySelectors, newProperties, retainGeometry) | FeatureCollection |
Argument | Typ | Szczegóły |
---|
to: featurecollection | FeatureCollection | Instancja FeatureCollection. |
propertySelectors | List<String> | Lista nazw lub wyrażeń regularnych określających atrybuty do wybrania. |
newProperties | List<String>, opcjonalnie | Lista nowych nazw właściwości wyjściowych. Musi być zgodna z liczbą wybranych usług. |
retainGeometry | Wartość logiczna, opcjonalna | Jeśli ma wartość false, wynik będzie miał geometrię NULL. Domyślna wartość to true. |
Przykłady
Edytor kodu (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());
Konfiguracja Pythona
Informacje o interfejsie Python API i używaniu geemap
do interaktywnego programowania znajdziesz na stronie
Środowisko Python.
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())
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-25 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-25 UTC."],[[["\u003cp\u003e\u003ccode\u003eFeatureCollection.select()\u003c/code\u003e allows you to select specific properties (attributes) from each feature within a FeatureCollection.\u003c/p\u003e\n"],["\u003cp\u003eYou can select properties by their names, rename them, and optionally retain or remove the feature's geometry.\u003c/p\u003e\n"],["\u003cp\u003eIt accepts arguments like \u003ccode\u003epropertySelectors\u003c/code\u003e for specifying properties to select, \u003ccode\u003enewProperties\u003c/code\u003e for renaming them, and \u003ccode\u003eretainGeometry\u003c/code\u003e to control geometry inclusion.\u003c/p\u003e\n"],["\u003cp\u003eThe function returns a new FeatureCollection containing only the selected properties (and potentially modified geometry) for each feature.\u003c/p\u003e\n"]]],[],null,["# ee.FeatureCollection.select\n\n\u003cbr /\u003e\n\nSelect properties from each Feature in a collection. It is also possible to call this function with only string arguments; they will be all be interpreted as propertySelectors (varargs).\n\n\u003cbr /\u003e\n\nReturns the feature collection with selected properties.\n\n| Usage | Returns |\n|---------------------------------------------------------------------------------------|-------------------|\n| FeatureCollection.select`(propertySelectors, `*newProperties* `, `*retainGeometry*`)` | FeatureCollection |\n\n| Argument | Type | Details |\n|---------------------------|--------------------------|----------------------------------------------------------------------------------------------|\n| this: `featurecollection` | FeatureCollection | The FeatureCollection instance. |\n| `propertySelectors` | List\\\u003cString\\\u003e | A list of names or regexes specifying the attributes to select. |\n| `newProperties` | List\\\u003cString\\\u003e, optional | A list of new names for the output properties. Must match the number of properties selected. |\n| `retainGeometry` | Boolean, optional | When false, the result will have a NULL geometry. Defaults to true. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// FeatureCollection of power plants in Belgium.\nvar fc = ee.FeatureCollection('WRI/GPPD/power_plants')\n .filter('country_lg == \"Belgium\"');\n\n// Select a single property.\nvar singleProp = fc.select('fuel1');\nprint('Single property selected',\n singleProp.first());\n\n// Select multiple properties.\nvar multiProp = fc.select(['fuel1', 'capacitymw']);\nprint('Multiple properties selected',\n multiProp.first());\n\n// Select multiple properties and rename them.\nvar multiPropRename = fc.select({\n propertySelectors: ['fuel1', 'capacitymw'],\n newProperties: ['Fuel_1', 'Capacity_MW']\n});\nprint('Multiple properties selected, renamed',\n multiPropRename.first());\n\n// Select multiple properties, remove geometry.\nvar multiPropNoGeom = fc.select({\n propertySelectors: ['fuel1', 'capacitymw'],\n retainGeometry: false\n});\nprint('Multiple properties selected, geometry removed',\n multiPropNoGeom.first());\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# FeatureCollection of power plants in Belgium.\nfc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(\n 'country_lg == \"Belgium\"')\n\n# Select a single property.\nsingle_prop = fc.select('fuel1')\nprint('Single property selected:', single_prop.first().getInfo())\n\n# Select multiple properties.\nmulti_prop = fc.select(['fuel1', 'capacitymw'])\nprint('Multiple properties selected:', multi_prop.first().getInfo())\n\n# Select multiple properties and rename them.\nmulti_prop_rename = fc.select(**{\n 'propertySelectors': ['fuel1', 'capacitymw'],\n 'newProperties': ['Fuel_1', 'Capacity_MW']\n })\nprint('Multiple properties selected, renamed:',\n multi_prop_rename.first().getInfo())\n\n# Select multiple properties, remove geometry.\nmulti_prop_no_geom = fc.select(**{\n 'propertySelectors': ['fuel1', 'capacitymw'],\n 'retainGeometry': False\n })\nprint('Multiple properties selected, geometry removed:',\n multi_prop_no_geom.first().getInfo())\n```"]]