Table of Contents

Pydeck EarthEngineTerrainLayer

The pydeck EarthEngineTerrainLayer connects Google Earth Engine to pydeck, making it possible to visualize planetary-scale geospatial datasets over 3D terrain from Python.

To use this layer, you'll need to authenticate with an EarthEngine-enabled Google Account. Visit here to sign up.

from pydeck_earthengine_layers import EarthEngineTerrainLayer
import pydeck as pdk
import ee

# Initialize Earth Engine library

# Create Earth Engine objects for visualization and terrain heights
image = ee.Image('USGS/SRTMGL1_003')
terrain = ee.Image('USGS/NED').select('elevation')

# Define Earth Engine visualization parameters
vis_params = {
    "min": 0, 
    "max": 4000,
    'palette': ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']

# Create a pydeck EarthEngineTerrainLayer object, using the Earth Engine objects and
# desired visualization parameters
ee_layer = EarthEngineTerrainLayer(image, terrain, vis_params)

# Define the initial viewport for the map
view_state = pdk.ViewState(

# Create a Deck instance, and display in Jupyter
r = pdk.Deck(layers=[ee_layer], initial_view_state=view_state)


See the pydeck integration guide for installation instructions.


The pydeck-earthengine-layer package exports the EarthEngineTerrainLayer class. This makes interfacing with EarthEngine easy: behind the scenes it handles authentication, loading the EarthEngine JavaScript library, and correctly passing the EarthEngine objects to JavaScript.


  • ee_object: (required), an instance of a Python EarthEngine Image object used for visualization
  • ee_terrain_object: (required), an instance of a Python EarthEngine Image object used for terrain heights
  • vis_params: (dict, optional), parameters for how to visualize the EarthEngine object. See EarthEngine documentation for expected dict layout. Default: None.
  • credentials: (optional), Google OAuth2 credentials object. Default: saved credentials are loaded automatically.
  • library_url: (str, optional), Force loading of the JavaScript EarthEngineLayer bundle for a specific URL. By default, loads from the most recent EarthEngineLayer release.

All properties accepted by the JavaScript EarthEngineTerrainLayer are accepted as keyword arguments.