Annuncio: tutti i progetti non commerciali registrati per l'utilizzo di Earth Engine prima del
15 aprile 2025 devono
verificare l'idoneità non commerciale per mantenere l'accesso a Earth Engine.
ee.FeatureCollection.select
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Seleziona le proprietà di ogni funzionalità di una raccolta. È anche possibile chiamare questa funzione solo con argomenti stringa, che verranno interpretati tutti come propertySelectors (varargs).
Restituisce la raccolta di caratteristiche con le proprietà selezionate.
Utilizzo | Resi |
---|
FeatureCollection.select(propertySelectors, newProperties, retainGeometry) | FeatureCollection |
Argomento | Tipo | Dettagli |
---|
questo: featurecollection | FeatureCollection | L'istanza FeatureCollection. |
propertySelectors | List<String> | Un elenco di nomi o espressioni regolari che specificano gli attributi da selezionare. |
newProperties | List<String>, facoltativo | Un elenco di nuovi nomi per le proprietà di output. Deve corrispondere al numero di proprietà selezionate. |
retainGeometry | Booleano, facoltativo | Se il valore è false, il risultato avrà una geometria NULL. Il valore predefinito è true. |
Esempi
Editor di codice (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());
Configurazione di Python
Consulta la pagina
Ambiente Python per informazioni sull'API Python e sull'utilizzo di
geemap
per lo sviluppo interattivo.
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())
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-07-25 UTC.
[null,null,["Ultimo aggiornamento 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```"]]