Search code examples
pythongoogle-earth-engine

EEException: Image.visualize: Parameter 'image' is required


Im trying to use planet labs skysat ortho rgb high res satellite to give me an overlayed raster but cant come up with anything: Here is my code;

parameters for Image collection

lc = ee.ImageCollection('SKYSAT/GEN-A/PUBLIC/ORTHO/MULTISPECTRAL')
i_date = '2014-08-03'
lc_img = lc.select(['N', 'G', 'B']).filterDate(i_date).first()

Initialization block

# Set visualization parameters for land cover.
lc_vis_params = {
    'min':200.0,
    'max':6000.0,
}

# Create a map.
lat, lon = -70.892, 41.6555
my_map = folium.Map(location=[lat, lon], zoom_start=7)

# Add the land cover to the map object.
my_map.add_ee_layer(lc_img, lc_vis_params, 'RGB')

# Add a layer control panel to the map.
my_map.add_child(folium.LayerControl())

# Display the map.
display(my_map)

this is the error Im getting

---------------------------------------------------------------------------
HttpError                                 Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/ee/data.py in _execute_cloud_call(call, num_retries)
    329   try:
--> 330     return call.execute(num_retries=num_retries)
    331   except googleapiclient.errors.HttpError as e:

6 frames
HttpError: <HttpError 400 when requesting https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/maps?fields=name&alt=json returned "Image.visualize: Parameter 'image' is required.". Details: "Image.visualize: Parameter 'image' is required.">

During handling of the above exception, another exception occurred:

EEException                               Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/ee/data.py in _execute_cloud_call(call, num_retries)
    330     return call.execute(num_retries=num_retries)
    331   except googleapiclient.errors.HttpError as e:
--> 332     raise _translate_cloud_exception(e)
    333 
    334 

EEException: Image.visualize: Parameter 'image' is required.

Solution

  • The date interval appears to be the issue, as there are no images available.

    I made a few changes in order to run your code:

    lc = ee.ImageCollection('SKYSAT/GEN-A/PUBLIC/ORTHO/MULTISPECTRAL').filterDate(i_date,i_date2)
    i_date = '2014-01-01'
    i_date2 = '2014-12-01'
    lc_img = lc.first().select(['N', 'G', 'B'])
    # Set visualization parameters for land cover.
    lc_vis_params = {
        'min':200.0,
        'max':6000.0,
    }
    
    # Create a map.
    lat, lon = -70.892, 41.6555
    my_map = folium.Map(location=[lat, lon], zoom_start=7)
    print(lc.size().getInfo()) # quantity of images for the period
    # Add the land cover to the map object.
    #my_map.add_ee_layer(lc_img, lc_vis_params, 'RGB') "Sorry, i don't have the add_ee_layer function :)"
    mapid = lc_img.getMapId(lc_vis_params)
    folium.TileLayer(
        tiles=mapid['tile_fetcher'].url_format,
        attr='False Color',
        overlay=True,
        name='False Color',
    ).add_to(my_map)
    my_map