How can I get a download button for Google Earth Engine Image

Ask the community or our support engineers for answers to questions.
countries=ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017"); country = countries.filter(ee.Filter.eq('country_na', 'Cambodia')); esa = ee.ImageCollection("FIRMS").select('T21').filterBounds(country).filterDate(2022-07-01,2022-07-03).mosaic().clip(country); esa_vis = {"min": 325,"max": 400,"palette": ['red', 'orange', 'yellow'],} Map.addLayer(country,{}, name ="Cam Global Boundary") Map.addLayer(esa, esa_vis, 'fire') Map.to_streamlit(height=550) labels = ['Fire Detection'] colors = ['#FF0000'] Map.add_legend( title="Legend", labels=labels, colors=colors)
Dear everyone, I would like to make a button for downloading geotiff from Google Earth Engine. How can I perform that? I have attached the code above. Thank You!

Hi @yputhealy,

Thanks for posting! Have you checked out st.download_button?

Thank you so much @Caroline, I can add the button, but It cannot download the geotiff.

Hi @yputhealy,

Looks like you can do something like this and just add a Streamlit button:

from owslib.csw import CatalogueServiceWeb
import urllib

def getLinkByIDCWS(url, id, user, pwd):
    csw = CatalogueServiceWeb(url, username=user, password=pwd)


    link = csw.records[id].references[2]['url']

    return link

def downloadImage(url, fileName):
    urllib.request.urlretrieve(url, fileName)

url = "http://localhost:8080/geoserver/csw?service=CSW&version=2.0.2&request=GetRecords&typeNames=gmd:MD_Metadata&resultType=results&elementSetName=full&outputSchema="
record = "nurc:Arc_Sample"
name = "<user>"
pwd = "<pwd>"

link = getLinkByIDCWS(url, record, name, pwd)

downloadImage(link, "test.arc")

Thank You so much for your spending time on this topic. May I have another example with Google Earth Engine data collection on download button? I

Hi @yputhealy,

I donโ€™t have an example on-hand that does exactly what youโ€™re looking for, but it seems pretty doable for you to implement from the above example. Feel free to reach out to the community if you get stuck