Google Earth Engine – Using Map.addLayer Effectively

google-earth-engine

Is there a possibility to do "Map.addLayer" so the image is not already displayed in the output but can be loaded in via check mark in the layer dropdown?

(I would like to do the reverse of the default "Map.addLayer"….. visual go through multiple images, by default, all with Map.addLayer are displayed and I wondered if there is a better way, then manually disable each Layer in the Output by clicking away the check mark).

Best Answer

From the documentation

Map.addLayer(eeObject, visParams, name, shown, opacity)

Adds a given EE object to the map as a layer.

Returns the new map layer.

Arguments:

eeObject (Collection|Feature|Image|MapId): The object to add to the map.

visParams (FeatureVisualizationParameters|ImageVisualizationParameters, optional): The visualization parameters. For Images and ImageCollection, see ee.data.getMapId for valid parameters. For Features and FeatureCollections, the only supported key is "color", as a CSS 3.0 color string or a hex string in "RRGGBB" format.

name (String, optional): The name of the layer. Defaults to "Layer N".

shown (Boolean, optional): A flag indicating whether the layer should be on by default.

opacity (Number, optional): The layer's opacity represented as a number between 0 and 1. Defaults to 1.

Returns: ui.Map.Layer

I think what you want is done by parameter shown. Set it to false and the image will be added to the Map but not displayed

Related Question