I have been trying to troubleshoot my way through the Python API on GEE but I just cannot figure out the problem. I searched the forums for a similar issue but solutions I found didn't help with the problem.
I am trying to simply show an Image on Google Colab for now. My code is the following:
**# Get image collection**
sentinel_collection = ee.ImageCollection('COPERNICUS/S2_SR')
**# Filter by bates**
collection_time = sentinel_collection.filterDate('2017-03-28', '2019-12-08')
**# Create a square over region of interest**
square = ee.Geometry.Rectangle(coords=[
[-77.04931434943427,-12.11990118945657],
[-76.98579963996161,-12.09103199034111]],
proj=None)
collection_bounds = collection_time.filterBounds(square)
**# Filter to remove clouds that have > 5% cover**
clouds = collection_bounds.filter(ee.Filter.lt('CLOUD_COVER', 5))
**# Select appropriate bands**
bands = clouds.select(['B4', 'B3', 'B2'])
**# Create a composite image**
composite = bands.median()
**# Show the image**
Image(url=composite.getThumbUrl({'min':0,'max': 3000}))
I believe my filtering and selection process is all fine until the moment I call the getThumbnail method:
Image(url=composite.getThumbUrl({'min':0,'max': 3000}))
The Error code I am getting is a general error 500, which is not helpful at all:
---------------------------------------------------------------------------
HttpError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/ee/data.py in _execute_cloud_call(call, num_retries)
337 try:
--> 338 return call.execute(num_retries=num_retries)
339 except apiclient.errors.HttpError as e:
7 frames
HttpError: <HttpError 500 when requesting https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/thumbnails?fields=name&alt=json returned "An internal error has occurred">
During handling of the above exception, another exception occurred:
EEException Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/ee/data.py in _execute_cloud_call(call, num_retries)
338 return call.execute(num_retries=num_retries)
339 except apiclient.errors.HttpError as e:
--> 340 raise _translate_cloud_exception(e)
341
342
EEException: An internal error has occurred
I have been looking around to try and get an idea of where the problem lies, but I honestly have no clue. I tried different filtering options before calling the getThumbNail method, but had no luck.
All help is welcome!
See the documentation here.
https://developers.google.com/earth-engine/image_visualization
At the bottom of the page, it says:
Note: getThumbURL is intended as a method for producing preview images
you might include in presentations, websites, and social media posts.
Its size limitation is 100,000,000 pixels and the browser can timeout
for complicated requests.
If you want a large image or have a complex process, see the Exporting Data page.
So, your image is probably too big. Try to make it smaller or use Exporting Data (or for Python ).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.