Geemap cannot add colorbar!

I don’t know why the error was revealed with a dictionary. I cannot find anything wrong with it. Could you please solve this in geemap of streamlit? I would add the code below. Thank you!

dataset = ee.ImageCollection("MODIS/MOD09GA_006_NDWI").select('NDWI').filterBounds(country).filterDate(start_date,end_date).mosaic().clip(country)

vis_params = {
    'min': 0,
    'max': 1,
    'palette': ['0000ff', '00ffff', 'ffff00', 'ff0000', 'ffffff'],
colors= vis_params["palette"]
Map.addLayer(country,{}, name ="Cambodia Global Boundary")
Map.addLayer(dataset, vis_params, 'water', True, 1)

Map.add_colorbar(colors, 0, 1, caption="Modis")

The second argument to add_colorbar should be a dictionary, and you are passing an integer (0) instead.

1 Like