ee.FeatureCollection.getMap

Es una función imperativa que devuelve un ID y un token de mapa, adecuados para generar una superposición de mapa.

Devuelve un objeto que se puede pasar a ee.data.getTileUrl o ui.Map.addLayer, incluido un campo "image" adicional que contiene una imagen de Collection.draw que encapsula un FeatureCollection que contiene este elemento. Se define como indefinido si se especificó una devolución de llamada.

UsoMuestra
FeatureCollection.getMap(visParams, callback)MapId|Object
ArgumentoTipoDetalles
esta: featurecollectionFeatureCollectionInstancia de FeatureCollection.
visParamsObjeto, opcionalSon los parámetros de visualización. Actualmente, solo se permite un parámetro, "color", que contiene una cadena de color RGB. Si no se especifica vis_params, se usa el color #000000.
callbackFunción, opcionalEs una devolución de llamada asíncrona. Si no se proporciona, la llamada se realiza de forma síncrona.

Ejemplos

Editor de código (JavaScript)

// FeatureCollection of power plants in Belgium.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants')
            .filter('country_lg == "Belgium"');

// Get MapId for styled FeatureCollection.
var mapId = fc.getMap({color: '800080'});
print('mapId for styled FeatureCollection', mapId);

// MapId can be used as an input to Map.addLayer to display the layer.
Map.setCenter(4.56, 50.78, 7);
Map.addLayer(mapId);

// MapId can be used as an input to ee.data.getTileUrl to fetch map tiles.
print('URL for zoom level 6 tile that includes majority of points',
      ee.data.getTileUrl(mapId, 32, 21, 6));

Configuración de Python

Consulta la página Entorno de Python para obtener información sobre la API de Python y el uso de geemap para el desarrollo interactivo.

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"'
)

# Get MapId for styled FeatureCollection.
map_id = fc.getMapId({'color': '800080'})
display('map_id for FeatureCollection', map_id)

# MapId can be used as an input to geemap.Map.add_layer to display the layer.
m = geemap.Map()
m.set_center(4.56, 50.78, 7)
m.add_layer(map_id['image'])
display(m)

# MapId can be used as an input to ee.data.getTileUrl to fetch map tiles.
display(
    'URL for zoom level 6 tile that includes majority of points',
    ee.data.getTileUrl(map_id, 32, 21, 6),
)