Getting Set Up
Setting up an Account
Whether you use the JavaScript or Python API, you will have to sign-up for a Google Earth Engine account here. Registration is free and straightforward, but it takes approximately 24 hours to be approved to use the code editor.
- Note: using a personal email address is currently an easier process than using your .edu account.
Getting Started
Once the account is approved, you can access Google Earth Engine.
JavaScript
With JavaScript, you can get started immediately - as long as you are logged into Google with the account you created your account with, you can access the code editor immediately and start running scripts.
Python
Python takes a little more effort to set up - you have to:
- Install the Earth Engine library (one-time per environment)
- Authenticate your Earth Engine Account (one-time per environment)
- Initiate the API (Every time you run a script)
In addition, we will be using the geemap
package in conjunction with Earth Engine, install instructions are also included.
Install Earth Engine
Our class is set up in Google Colab, which already has the Earth Engine library installed. Follow along with the pip
instructions to ensure that your libraries are installed correctly. Also note that with Colab you will have to complete this step each time you start working with a notebook.
Over the long-term, it would benefit you to learn how to set up your local environment. There are some resources below that might help. If you are using your own, preferred system, install with either pip
or conda
based on your preference.
To run, take out the comment indicator (#
) in front of the command to run in a Jupyter Notebook.
# Install using `pip` - Use with Google Colab
#!pip install earthengine-api --upgrade
#!pip install geemap
# Install using Conda
# Ensure you activate a new conda environment
#!conda install -c conda-forge earthengine-api
#!conda install geemap -c conda-forge
Other Environments
There are some downsides of Google Colab - to access the terminal, you have to upgrade to the Pro version. Additionally, as a Google product it is tied in with Google Drive/Google Cloud, which might be a hindrance if your data is stored in another location. The Python development ecosystem is vast, with many options. If you will be working with Python in the long-term, it would be worthwhile to learn how to use tools such as Anaconda, Visual Studio Code, Atom, Sublime, Git, Jupyter Labs, DeepNote, Spyder, etc. This falls outside of the scope of this course, but if you'd like to learn more, the site Real Python would be a good starting point.
Authenticate Earth Engine
Once the earth engine library is installed, you will need to authenticate for your environment environment one time. Import the Earth Engine library and then follow the instructions - you will be redirected to another page where you will receive an token, which you then enter into the prompt. Once this is complete, this token is stored in your environment.
import ee
#ee.Authenticate()
Initiate Earth Engine
Once it is installed, you will have to initiate a session with the API every time you run a script. In the import section of your code, include the following to start using Earth Engine
# Initialize the Earth Engine module.
import ee, geemap
#ee.Initialize()