Google Earth Engine – Code Returning White Image

google-earth-enginegoogle-earth-engine-python-api

When I use the following code, it returns only white output as in the image. That only happens when I try to acquire level 2 data. TOA one is fine.

What is the potential way to fix it?

import ee
from datetime import datetime
from IPython.display import Image

# Initialize the Earth Engine API
ee.Initialize()

# Define the start and end date
startTime = datetime(2013,8,1)
endTime = datetime(2014,8,30)

# Get the Landsat 7 level 2 image collection
collection = ee.ImageCollection("LANDSAT/LE07/C02/T2_L2").filterDate(startTime, endTime)

# Sort the images by date and get the most recent image
recent = collection.sort('system:time_start', False).first()

# Define the visualization parameters
visParams = {'bands': ['SR_B3', 'SR_B2', 'SR_B1'], 'max': 255, 'dimensions': 1000}

# Create an image thumbnail from the recent image and display it
thumbnail = recent.getThumbUrl(visParams)
Image(url=thumbnail)

returned blank image

Best Answer

Value range of three bands is 0-65455 (Catalog Page). Therefore, when you specify max: 255, you make all pixels with values greater than 255 white. Since almost all values are greater than 255 in these bands, the image is rendered as white.

In order to solve the issue, remove max: 255.

Related Question