Anúncio: todos os projetos não comerciais registrados para usar o Earth Engine antes de
15 de abril de 2025 precisam
verificar a qualificação não comercial para manter o acesso ao Earth Engine.
ee.FeatureCollection.makeArray
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Adicione uma matriz unidimensional a cada recurso em uma coleção combinando uma lista de propriedades para cada recurso em uma matriz unidimensional. Todas as propriedades precisam ser valores numéricos. Se um recurso não tiver todas as propriedades nomeadas ou se alguma delas não for numérica, ele será removido da coleção resultante.
Uso | Retorna |
---|
FeatureCollection.makeArray(properties, name) | FeatureCollection |
Argumento | Tipo | Detalhes |
---|
isso: collection | FeatureCollection | A coleção de entrada de que as propriedades serão selecionadas. |
properties | Lista | As propriedades a serem selecionadas. |
name | String, padrão: "array" | O nome da nova propriedade de matriz. |
Exemplos
Editor de código (JavaScript)
// FeatureCollection of power plants in Belgium.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants')
.filter('country_lg == "Belgium"');
// A list of feature properties to combine into an array
// (power generation by year).
var properties = ['gwh_2013', 'gwh_2014', 'gwh_2015', 'gwh_2016'];
// Add array of power-generation-by-year property to features.
fc = fc.makeArray(properties, 'gwh_by_year');
print('FeatureCollection with array of selected properties added', fc);
print('See example of new "gwh_by_year" property', fc.first().toDictionary());
Configuração do Python
Consulte a página
Ambiente Python para informações sobre a API Python e como usar
geemap
para desenvolvimento interativo.
import ee
import geemap.core as geemap
Colab (Python)
from pprint import pprint
# FeatureCollection of power plants in Belgium.
fc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(
'country_lg == "Belgium"')
# A list of feature properties to combine into an array
# (power generation by year).
properties = ['gwh_2013', 'gwh_2014', 'gwh_2015', 'gwh_2016']
# Add array of power-generation-by-year property to features.
fc = fc.makeArray(properties, 'gwh_by_year')
print('FeatureCollection with array of selected properties added:',
fc.getInfo())
print('See example of new "gwh_by_year" property:')
pprint(fc.first().toDictionary().getInfo())
Exceto em caso de indicação contrária, o conteúdo desta página é licenciado de acordo com a Licença de atribuição 4.0 do Creative Commons, e as amostras de código são licenciadas de acordo com a Licença Apache 2.0. Para mais detalhes, consulte as políticas do site do Google Developers. Java é uma marca registrada da Oracle e/ou afiliadas.
Última atualização 2025-07-26 UTC.
[null,null,["Última atualização 2025-07-26 UTC."],[[["\u003cp\u003e\u003ccode\u003emakeArray()\u003c/code\u003e combines specified numeric properties of features within a FeatureCollection into a new 1-D array property.\u003c/p\u003e\n"],["\u003cp\u003eFeatures lacking any of the specified properties, or containing non-numeric values in those properties, are excluded from the output.\u003c/p\u003e\n"],["\u003cp\u003eThe resulting FeatureCollection contains the original features with an added array property holding the combined values.\u003c/p\u003e\n"],["\u003cp\u003eThe array property is named using the 'name' argument, defaulting to "array" if not provided.\u003c/p\u003e\n"]]],[],null,["# ee.FeatureCollection.makeArray\n\nAdd a 1-D Array to each feature in a collection by combining a list of properties for each feature into a 1-D Array. All of the properties must be numeric values. If a feature doesn't contain all of the named properties, or any of them aren't numeric, the feature will be dropped from the resulting collection.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-----------------------------------------------------|-------------------|\n| FeatureCollection.makeArray`(properties, `*name*`)` | FeatureCollection |\n\n| Argument | Type | Details |\n|--------------------|--------------------------|--------------------------------------------------------------|\n| this: `collection` | FeatureCollection | The input collection from which properties will be selected. |\n| `properties` | List | The properties to select. |\n| `name` | String, default: \"array\" | The name of the new array property. |\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// A list of feature properties to combine into an array\n// (power generation by year).\nvar properties = ['gwh_2013', 'gwh_2014', 'gwh_2015', 'gwh_2016'];\n\n// Add array of power-generation-by-year property to features.\nfc = fc.makeArray(properties, 'gwh_by_year');\n\nprint('FeatureCollection with array of selected properties added', fc);\nprint('See example of new \"gwh_by_year\" property', fc.first().toDictionary());\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\nfrom pprint import pprint\n\n# FeatureCollection of power plants in Belgium.\nfc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(\n 'country_lg == \"Belgium\"')\n\n# A list of feature properties to combine into an array\n# (power generation by year).\nproperties = ['gwh_2013', 'gwh_2014', 'gwh_2015', 'gwh_2016']\n\n# Add array of power-generation-by-year property to features.\nfc = fc.makeArray(properties, 'gwh_by_year')\n\nprint('FeatureCollection with array of selected properties added:',\n fc.getInfo())\nprint('See example of new \"gwh_by_year\" property:')\npprint(fc.first().toDictionary().getInfo())\n```"]]