Giter Club home page Giter Club logo

geemap-heroku's Introduction

geemap-heroku

Python scripts for deploying Earth Engine Apps to heroku, try it out: https://geemap-demo.herokuapp.com/

How to deploy your own Earth Engine Apps?

  • Sign up for a free heroku account.
  • Follow the instructions to install Git and Heroku Command Line Interface (CLI).
  • Authenticate heroku using the heroku login command.
  • Clone this repository: https://github.com/giswqs/geemap-heroku
  • Create your own Earth Engine notebook and put it under the notebooks directory.
  • Add Python dependencies in the requirements.txt file if needed.
  • Edit the Procfile file by replacing notebooks/geemap.ipynb with the path to your own notebook.
  • Commit changes to the repository by using git add . && git commit -am "message".
  • Create a heroku app: heroku create
  • Run the config_vars.py script to extract Earth Engine token from your computer and set it as an environment variable on heroku: python config_vars.py
  • Deploy your code to heroku: git push heroku master
  • Open your heroku app: heroku open

Optional steps

  • To specify a name for your app, use heroku apps:create example
  • To preview your app locally, use heroku local web
  • To hide code cells from your app, you can edit the Procfile file and set --strip_sources=True
  • To periodically check for idle kernels, you can edit the Procfile file and set --MappingKernelManager.cull_interval=60 --MappingKernelManager.cull_idle_timeout=120
  • To view information about your running app, use heroku logs --tail
  • To set an environment variable on heroku, use heroku config:set NAME=VALUE
  • To view environment variables for your app, use heroku config

Credits

The instructions above on how to deploy a voila application on heroku are adapted from voila-dashboards/voila-heroku.

geemap-heroku's People

Contributors

adamjduncan avatar augustinh22 avatar giswqs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

geemap-heroku's Issues

I have added the key in Heroku config_vars but I am getting this error. When run by jupyter voila it's working

Earth Engine App
To authorize access needed by Earth Engine, open the following URL in a web browser and follow the instructions:

https://code.earthengine.google.com/client-auth?scopes=https%3A//www.googleapis.com/auth/earthengine%20https%3A//www.googleapis.com/auth/devstorage.full_control&request_id=9VJRWiemEVkPLY2h550_HkB5-JyKRjH86je8n038p-A&tc=xTMdt__slBkZHi7NZYGSw_r4wPmZQhpaOLlKDecjeOM&cc=JIpYkgp4F048wbW_nP7lmWABhN25filj4By0uBXG08E

The authorization workflow will generate a code, which you should paste in the box below

There was an error when executing cell [2]. Please run Voilà with --show_tracebacks=True or --debug to see the error message, or configure VoilaConfiguration.show_tracebacks.

trouble opening app on web and locally

image
I have again cloned the repo and receive the above error message when trying to view the water-app. When I try to open the app locally with heroku local web i receive this error message: ImportError: cannot import name 'StaticModule' from 'setuptools.config' (/usr/lib/python3/dist-packages/setuptools/config.py). I followed the instructions for adding the EE token to Config Vars on the heroku website. What am I missing?

Having EARTHENGINE_TOKEN as a heroku config var doesn't seem to work anymore

I ran the config_vars.py script and verified in Heroku that the config var exists with the correct content. However, the app fails to run. I added --debug flag in Procfila for voila and this is what I get:

FileNotFoundError                         Traceback (most recent call last)
~/.heroku/python/lib/python3.8/site-packages/ee/data.py in get_persistent_credentials()
    218   try:
--> 219     tokens = json.load(open(oauth.get_credentials_path()))
    220     refresh_token = tokens['refresh_token']

FileNotFoundError: [Errno 2] No such file or directory: '/app/.config/earthengine/credentials'

During handling of the above exception, another exception occurred:

EEException                               Traceback (most recent call last)
<ipython-input-1-44c582ebe6c9> in <module>
     11 
     12 #ee.Authenticate()
---> 13 ee.Initialize()

~/.heroku/python/lib/python3.8/site-packages/ee/__init__.py in Initialize(credentials, opt_url, cloud_api_key, http_transport, project)
    113   """
    114   if credentials == 'persistent':
--> 115     credentials = data.get_persistent_credentials()
    116   data.initialize(
    117       credentials=credentials,

~/.heroku/python/lib/python3.8/site-packages/ee/data.py in get_persistent_credentials()
    227         scopes=oauth.SCOPES)
    228   except IOError:
--> 229     raise ee_exception.EEException(
    230         'Please authorize access to your Earth Engine account by '
    231         'running\n\nearthengine authenticate\n\nin your command line, and then '

EEException: Please authorize access to your Earth Engine account by running

earthengine authenticate

in your command line, and then retry.

I wonder if something has change in the python ee library or why the authentication doesn't seem to work.

error authentication - solved

Hello, I was strugling with the authentication issue, heroku did not regonize. I don't know why the credentials are not being copy well from the code, but I could fix it by coppying the full code id+token and not only the token. I hope it helps somebody with the same issue.

Thank you by the awesome material

e2

Please authorize access to your Earth Engine account by running earthengine authenticate

Hi, I haved some problems with the earthengine authenticate, I used a alternative way:

In the first cell in jupyter notebook:

import ee
import json
from ee import oauth

refresh_token =("YOUR API KEY FORM .config/earthengine/credentials")

from google.oauth2.credentials import Credentials

clave = Credentials(
    None,
    refresh_token=refresh_token,
    token_uri=oauth.TOKEN_URI,
    client_id=oauth.CLIENT_ID,
    client_secret=oauth.CLIENT_SECRET,
    scopes=oauth.SCOPES)

ee.Initialize(credentials = clave)

I dont know if a is a secure option, you know? but is work well.

Thanks for geemap, is a awesome!!!

Best regards.
Franco Frolla

Trying onrender.com instead of Heroku

Following Heroku discontinuing its free tier, I have been look at moving my app to another free alternative, such as onrender.com.

I'm using the same repository and setting a secret EARTHENGINE_TOKEN properly. Unfortunately I am still encountering authentication problems and I can't work out what I'm missing.

RefreshError: ('invalid_grant: Bad Request', {'error': 'invalid_grant', 'error_description': 'Bad Request'})

The app is hosted at https://spen-farm.onrender.com/. (It used to be spen-farm.herokuapp.com).

I am posting here as the procedure is almost identical to the Heroku set-up, and I'm hoping there's a quick solution. Please let me know if there's any other places to host geemap apps for free (I'm having similar auth issues with streamlit).

Thanks

map.HTML not opening

I have converted geemap to map.html but it's not opening in any browser. I have tried to open in explorer and google chrome.

Web App is asking for authentication

169529164-59dd16d9-1e92-421f-9aaf-4bc4f94cdac8
I have google earth authentication isuue I have done same as said and I haven't changed my notebook(used as in repo for testing).And I have above error.
I add voila.json file with
{ "VoilaConfiguration": { "show_tracebacks": true } }
then voila error was removed but the following error showed up .
169533641-fe47143d-7831-4f85-87e0-104c99380116
![169533650-cfea801a-db6e-422e-912b-63077376be2c](https://user-images.githubuserco
169533653-5ce0d959-826a-4f05-afb4-c8061ef859a8
ntent.com/96986350/169667220-90c93bfe-cc74-463d-9e02-875af4bfbb3a.png)
169533657-e093c06c-d39f-43e6-ba4c-de9adc54465d

The notebook that I have used is
Screenshot (427)
Screenshot (428)
config_vars.py is
Screenshot (429)
Screenshot (430)

python config_vars.py error

I followed the steps to run the example. When excute the python config_vars.py, the error occured as follow:

Command '['heroku', 'config:set', 'EARTHENGINE_TOKEN="******]' returned non-zero exit status 1.

Application error issue

I have done everything as there is in tutorial but the webpage is not loading. I have used the water_app.ipynb as notebook, provided is repo. but application error showed up. I have attached the error logs.
Screenshot (11)
Screenshot (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.