TransWikia.com

Brackets meaning on EE visParams of Map.addLayer?

Geographic Information Systems Asked on July 10, 2021

In the context of https://docs.google.com/document/d/1mNIRB90jwLuASO1JYas1kuOXCLbOoy1Z4NlV1qIXM10/edit# section 3, there is one commented line:

// Map.addLayer(trend, {}, 'trend array image');

From Map.addLayer(eeObject, visParams, name, shown, opacity) documentation, I see it refers to:

  • 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.

Is that right? May I ask for a more elaborated explanation of it?

One Answer

It means that you are providing the addLayer function an empty object.

When you add a layer to a map, it pulls a default set of visualization configurations that users don't need to mess with unless you want the map to look different. You can even skip this parameter altogether and not give anything from the function call. For example,

Map.addLayer(trend)

But if you provide some parameters within the brackets, it will change the values for default visualization to what you provided. for example,

Map.addLayer(trend, {bands:'red,green,blue',max:18000})

or something that you want. There is a detailed description on what can be provided within those brackets here for images and here for features.

In short, what goes within those brackets in place of visParams controls how your data appears on the map (does not change the data at all).

Answered by Nishanta Khanal on July 10, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP