Part 1 Primer: Google Earth Engine for Tethys Developers
Last Updated: July 2024
This tutorial provides links to Google Earth Engine tutorials and resources that can be used to learn what you need to know for this Tethys tutorial. This is by no means exhaustive and we encourage you to familiarize yourself with everything Google Earth Engine has to offer by visiting their documentation: https://developers.google.com/earth-engine/. You will need an active Google Earth Engine account to complete this tutorial.
1. What is Google Earth Engine?
Review the Google Earth Engine Introduction.
2. Google Earth Engine JavaScript API
As a Tethys Developer, you will likely use the the Python API more often than the JavaScript API. However, there are not as many examples or documentation for Python. We recommend becoming familiar with the JavaScript examples and then learning how to convert any JavaScript example into the Python equivalent.
Complete the Get Started guide.
3. Google Earth Engine Python API
Complete the Python Installation - Colab Notebook guide
4. Convert JavaScript Example to Python
Review the following syntax differences between the JavaScript and Python APIs: JavaScript-Python Syntax Comparison
Choose an example from the Scripts tab of the Code Editor and convert it into Python in the Colab editor using the guidelines from the article above.
5. Create a Google Cloud Account and New Project
If you plan to use Google Earth Engine in your Tethys App, you will need to create a Google Cloud Account and set up a new project. Follow the instructions in the Google Cloud Platform Quickstart.
6. Create a Google Earth Engine Conda Environment
Create a new Conda environment with Google Earth Engine installed:
conda create --name ee
conda activate ee
conda install -c conda-forge earthengine-api
7. Authenticate with Google Earth Engine
Before you can use Google Earth Engine in your Tethys Development or in a Jupyter Notebook, you'll need to do a one-time authentication using the command line tool:
earthengine authenticate
Note
The Google Earth Engine command line tool is installed when you install the conda package.
A URL will be provided in the terminal. Open the URL in a browser and follow the instructions to authenticate with your Google Earth Engine account.
Next, you'll need to set your project ID for the Google Earth Engine Python API moving forward:
Run the following command and replace <project_id>
with your Google Cloud Project ID:
earthengine set_project <project_id>