Skip to content
Rodrigo E. Principe edited this page Oct 4, 2019 · 11 revisions

map

addImageCollection(collection, options)

Adds all images from an ee.ImageCollection to the Map. Argument options:

  • visParams: visualization parameters (for all images)
  • active: true make layers to be active when added. Defaults to false for speed reasons
  • namePattern: a name pattern. See: image.makeName
  • datePattern: the pattern for dates

https://code.earthengine.google.com/0d85e1d715c8ea66a3dad3d8a94ba19f

removeLayerByName(name, map)

Remove a layer from a map by its name. If argument map is not passed, it will use the default Map. If the name is duplicated it will be removed in all instances. Returns a list with the indexes of the replaced layers.

removeLayer(layer, map)

Remove a layer (ui.Map.Layer) from a map. If argument map is not passed, it will use the default Map. Returns a list with the indexes of the replaced layers.

removeObject(eeobject, map)

Remove an Earth Engine object (ee.Image, ee.Geometry, etc) from the map. If argument map is not passed, it will use the default Map. Returns a list with the indexes of the replaced layers.

replaceLayer(layer, newlayer, map)

Replace a layer (ui.Map.Layer) for newlayer in the map. If argument map is not passed, it will use the default Map. Returns a list with the indexes of the replaced layers.

getLayer(name, map)

Get a layer by its name. Return the layer (not the eeObject)

var image = ee.Image(0) // test image
Map.addLayer(image, {min:0, max:1}, 'layer_name')

var layer = tools.map.getLayer('layer_name')

var layer_object = layer.getEeObject() // the image
var layer_name = layer.getName()
var layer_vis = layer.getVisParams()
// etc..

https://code.earthengine.google.com/024ee27e25be6439e3f0b81d674019f4