I am trying to learn GEE's Python API through Google Colab. Right now I am trying to map Landsat using folium and geehydro. I was able to implement NDVI just fine, and it displayed exactly as I intended, but now I am having trouble figuring out the best way to display the bands to show RGB. Here's the code I have so far, it isn't working as intended-- it just shows a white tile.

import ee
import geemap
import geehydro
import folium

#Dates for imagery acquisition
i_date = '2020-01-01'
f_date = '2020-12-30'

#AOI point in Alabama
my_AOI = ee.Geometry.Point([-87, 33])

#Fetching Landsat 8 RGB as ee Image Collection for 2020
landsat = ee.ImageCollection("LANDSAT/LC08/C02/T1_L2").filterDate(i_date,f_date).filterBounds(my_AOI).min()

#Starts the map at the right location.
Map = folium.Map(location=[33,-87],zoom_start=8)

#Corresponding bands for L8
red = landsat.select("SR_B4")
green = landsat.select("SR_B3")
blue = landsat.select("SR_B2")

#Do RGB parameters work like this to display bands?  This is where I'm confused
rgb_params = {'bands': ['SR_B5','SR_B4','SR_B3'],
              'min': 0,
              'max': 0.3}

Map.addLayer(landsat,rgb_params, 'RGB Image')

1 Answer 1


It looks like there are two issues.

The first is that the code you included isn't working because folium.Map.addLayer is not a real method. I think you're mixing that up with geemap.Map.addLayer, which is the recommended solution for viewing Earth Engine data in Python. Using the code below will allow you to use the addLayer method with your image.

Map = geemap.Map(center=[33, -87], zoom=8)

The second problem is that the minimum and maximum values you define in rgb_params are much smaller than the scaled and offset Landsat pixel values, causing the image to appear white. You could fix this by changing the min and max to roughly 7000 and 25000, respectively, but if you plan to do any analysis or use vegetation indices you should undo the scale and offset instead.

Landsat images in Earth Engine are stored with their values scaled and offset to reduce storage space. As shown in the official example for this collection, you can undo the scale and offset by multiplying and adding a constant value to each image. Here's your code, modified to include the scaling.

# Applies scaling factors.
def apply_scale_factors(image):
  optical_bands = image.select('SR_B.').multiply(0.0000275).add(-0.2)
  thermal_bands = image.select('ST_B.*').multiply(0.00341802).add(149.0)
  return image.addBands(optical_bands, None, True).addBands(
      thermal_bands, None, True

#Fetching Landsat 8 RGB as ee Image Collection for 2020
landsat = (
    # Adjust each image in the collection to the correct range

Now, the rgb_params you originally defined should be in the correct range and your image should appear as expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.