Copyright 2018 Google LLC.
SPDX-License-Identifier: Apache-2.0
The Earth Engine Python API and command line tools can be installed using Python's pip
package installation tool. The following notebook cell line is starts with !
to indicate that a shell command should be invoked.
In [0]:
!pip install earthengine-api
In order to access Earth Engine, signup at signup.earthengine.google.com.
Once you have signed up and the Earth Engine package is installed, use the earthengine authenticate
shell command to create and store authentication credentials on the Colab VM. These credentials are used by the Earth Engine Python API and command line tools to access Earth Engine servers.
You will need to follow the link to the permissions page and give this notebook access to your Earth Engine account. Once you have authorized access, paste the authorization code into the input box displayed in the cell output.
In [0]:
import ee
# Check if the server is authenticated. If not, display instructions that
# explain how to complete the process.
try:
ee.Initialize()
except ee.EEException:
!earthengine authenticate
In [0]:
import ee
from IPython.display import Image
# Initialize the Earth Engine module.
ee.Initialize()
# Display a thumbnail of a sample image asset.
Image(url=ee.Image('CGIAR/SRTM90_V4').getThumbUrl({'min': 0, 'max': 3000}))