How to authenticate Earth Engine with Streamlit? #588
|
Hi there, I have been intrigued to try and deploy a Streamlit app since you shared your youtube example and was taking some time this morning to try and deploy a simple landsat imagery app. I think I have the app set up correctly as well as the requirements.txt but when I try to deploy I can't figure out how to use the EARTHENGINE_TOKEN in the streamlit secrets to authenticate. Was trying to reference your examples but couldn't really understand how you implemented the token. Additionally, just to double check, the token is the code you get if you were to follow the ee.Authenticate() workflow, correct? Would appreciate your insight! Thanks for your amazing work as always! |
Replies: 1 comment 1 reply
|
You need to use https://github.com/giswqs/geemap-streamlit/blob/main/geemap_app.py |
You need to use
geemap.Map()orgeemap.ee_initialize()before you do anything with ee.geemap.Map()will authenticate and initialize ee when needed. Do NOT useee.Authenticate()oree.Initialize(). Otherwise, your program will fail. TheEARTHENGINE_TOKENcomes from your computer~/.config/earthengine/credentials, not the code you get from the ee.Authenticate() workflow.https://github.com/giswqs/geemap-streamlit/blob/main/geemap_app.py