Hint

You can run this notebook in a live session with Binder.

Get Copernicus DEM using EODAG#

This tutorial will help you to search and download Copernicus DEM using EODAG

[1]:
import os
from eodag import EODataAccessGateway

Create a workspace directory eodag_workspace_copdem where all our files will live:

[2]:
workspace = 'eodag_workspace_copdem'
if not os.path.isdir(workspace):
    os.mkdir(workspace)

Search products#

Init EODAG and get available product types from Copernicus DEM

[3]:
dag = EODataAccessGateway()

dag.guess_product_type(keywords="DEM")
[3]:
['COP_DEM_GLO30_DGED',
 'COP_DEM_GLO30_DTED',
 'COP_DEM_GLO90_DGED',
 'COP_DEM_GLO90_DTED']

Check which providers support COP_DEM_GLO30_DGED

[4]:
product_type = "COP_DEM_GLO30_DGED"
dag.available_providers(product_type)
[4]:
['creodias', 'wekeo']
[5]:
search_geom = [0.25, 43.2, 2.8, 43.9]
search_result, count = dag.search(productType=product_type, geom=search_geom)
search_result
Product type 'COP_DEM_GLO30_DGED' is not available with provider 'peps'. Searching it on provider 'creodias' instead.
[5]:
SearchResult([EOProduct(id=DEM1_SAR_DGE_30_20110216T174143_20140906T174215_ADS_000000_jSLP, provider=creodias),
              EOProduct(id=DEM1_SAR_DGE_30_20110417T175032_20140906T174215_ADS_000000_PIJx, provider=creodias),
              EOProduct(id=DEM1_SAR_DGE_30_20110428T174952_20140831T175054_ADS_000000_Q3FX, provider=creodias)])

Draw results geometries on a map:

[6]:
import folium

# Create a map zoomed over the search area
fmap = folium.Map([43.5, 1.5], zoom_start=8)
# Create a layer that represents the search area in red
folium.Rectangle(
    bounds=[search_geom[0:2][::-1], search_geom[2:4][::-1]],
    color="red",
    tooltip="Search extent"
).add_to(fmap)
# Create a layer that maps the products found
folium.GeoJson(
    data=search_result,  # SearchResult has a __geo_interface__ interface used by folium to get its GeoJSON representation
    tooltip=folium.GeoJsonTooltip(fields=["title"])
).add_to(fmap)
fmap

[6]:
Make this Notebook Trusted to load map: File -> Trust Notebook

Download the DEM files to workspace#

Make sure credentials were set for the provider. Here we will download on creodias that needs an additionnal TOTP key:

[7]:
dag.update_providers_config(
   """
   creodias:
      auth:
         credentials:
            totp: PLEASE_CHANGE_ME
   """
)
[8]:
paths = dag.download_all(
    search_result,
    outputs_prefix=workspace,
)
paths
[8]:
['/home/sylvain/workspace/eodag/docs/notebooks/tutos/eodag_workspace_copdem/DEM1_SAR_DGE_30_20110216T174143_20140906T174215_ADS_000000_jSLP/DEM1_SAR_DGE_30_20110216T174143_20140906T174215_ADS_000000_jSLP.DEM',
 '/home/sylvain/workspace/eodag/docs/notebooks/tutos/eodag_workspace_copdem/DEM1_SAR_DGE_30_20110428T174952_20140831T175054_ADS_000000_Q3FX/DEM1_SAR_DGE_30_20110428T174952_20140831T175054_ADS_000000_Q3FX.DEM',
 '/home/sylvain/workspace/eodag/docs/notebooks/tutos/eodag_workspace_copdem/DEM1_SAR_DGE_30_20110417T175032_20140906T174215_ADS_000000_PIJx/DEM1_SAR_DGE_30_20110417T175032_20140906T174215_ADS_000000_PIJx.DEM']
[ ]: