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. Se você não fizer a verificação até 26 de setembro de 2025, seu acesso poderá ser suspenso.
ee.FeatureCollection.map
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Mapeia um algoritmo em uma coleção.
Retorna a coleção mapeada.
| Uso | Retorna |
|---|
FeatureCollection.map(algorithm, dropNulls) | Coleção |
| Argumento | Tipo | Detalhes |
|---|
isso: collection | Coleção | A instância da coleção. |
algorithm | Função | A operação para mapear as imagens ou recursos da coleção. Uma função JavaScript que recebe uma imagem ou recursos e retorna um deles. A função é chamada apenas uma vez, e o resultado é capturado como uma descrição. Portanto, ela não pode realizar operações imperativas nem depender de um estado externo. |
dropNulls | Booleano, opcional | Se for verdadeiro, o algoritmo mapeado poderá retornar valores nulos, e os elementos para os quais ele retorna valores nulos serão descartados. |
Exemplos
Editor de código (JavaScript)
// FeatureCollection of power plants in Belgium.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants')
.filter('country_lg == "Belgium"');
// Function to convert power plant capacity from megawatts to gigawatts and
// add the value as a new feature property.
var mwToGw = function(feature) {
var megawatt = feature.getNumber('capacitymw');
var gigawatt = megawatt.divide(1000);
return feature.set('capacitygw', gigawatt);
};
// Apply the function to each feature in the collection.
fc = fc.map(mwToGw);
print('Note the new "capacitygw" property in each feature', fc);
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)
# FeatureCollection of power plants in Belgium.
fc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(
'country_lg == "Belgium"')
# Function to convert power plant capacity from megawatts to gigawatts and
# add the value as a new feature property.
def mw_to_gw(feature):
megawatt = feature.getNumber('capacitymw')
gigawatt = megawatt.divide(1000)
return feature.set('capacitygw', gigawatt)
# Apply the function to each feature in the collection.
fc = fc.map(mw_to_gw)
display('Note the new "capacitygw" property in each feature:', fc)
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-10-30 UTC.
[null,null,["Última atualização 2025-10-30 UTC."],[],["The `map` algorithm applies a user-defined function to each element within a collection (e.g., features or images). This function, which accepts an element as input and returns a modified one, is applied to each item of the collection. The `dropNulls` argument allows filtering null return values. The result is a new collection containing the modified elements. For example, converting power plant capacity units and adding them as a new property to the features.\n"]]