Publishing a Google Earth Engine App on Heroku using the command line

Deploying an app without connecting your GitHub account

Aditya Sharma
Towards Dev

--

If you have developed a streamlit application based on Google Earth Engine’s Python API and/or geemap library, publishing on Heroku using the command line is very easy and convenient. In this article I will outline how to publish a GoogleEarthEngine (GEE) application using Herokou CLI and Git. This is useful if you want to publish an application directly from your local drive or in case you’re just testing out whether the app works as intended (sometimes different errors can popup when you’re testing on your local server compared to an online server).

Publishing a new application

Navigate to the folder where you have your code setup.

cd my_project_directory

Initialize git in your working directory. This requires Git to be setup on your machine.

git init
git add .
git commit -am "INITIAL COMMIT MESSAGE"

Create a project using Heroku CLI.

heroku create my_project

Assign EarthEngine token as a configuration variable in Heroku.

Note: The procedure to generate and locate your EarthEngine token are outlined in the official documentation. The key is to locate a text file called credentials in your user profile where the authorization token is stored.

heroku config:set EARTHENGINE_TOKEN=YOUR_EE_TOKEN

Set Python as the language for building our Heroku application.

heroku buildpacks:set heroku/python

Publish application by pushing code to our Heroku project. When we initialize git in our project folder, a branch called master is created by default and this is where we want to push our code.

git push heroku master

Deploying changes to an existing Heroku application

Once you have published your EarthEngine-based streamlit application on Heroku, you can use the command line terminal to push any further changes.

Navigate to the folder where you have your code setup.

cd my_project_directory

Add and commit changes to the existing git repository.

git add .
git commit -am "COMMIT MESSAGE"

Publish changes to your application by using the git push command.

git push heroku master

Hopefully, this post will help you publish a an EarthEngine-powered streamlit application on Heroku right from the command line terminal.

--

--

Geoscientist and data science enthusiast interested in applied use of remote sensing satellites.