First steps using Harmonised Data access API¶
Discover data of DestinE Data Portfolio
Search data of DestinE Data Portfolio and visualize the results
Access Data of DestinE Data Portfolio and visualize the thumbnails
This notebook demonstrates how to use the HDA (Harmonized Data Access) API by sending a few HTTP requests to the API, using Python code.
Throughout this quickstart notebook, you will learn:
Discover: How to discover DEDL services and data collections through HDA.
Authenticate: How to authenticate to search and access DEDL collections.
Search data: How to search DEDL data through HDA.
Visualize search results: How to see the results.
Download data: How to download DEDL data through HDA.
The detailed API and definition of each endpoint and parameters is available in the HDA Swagger UI at:
For Data discovery: none
For Data access : DestinE user account
Discover¶
Settings¶
Import the relevant modules¶
We start off by importing the relevant modules for HTTP requests and json handling.
pip install --user --quiet --upgrade destinelabNote: you may need to restart the kernel to use updated packages.
from typing import Union
import requests
import json
import urllib.parse
from IPython.display import JSON
from IPython.display import Image
import geopandas
import folium
import folium.plugins
from branca.element import Figure
import shapely.geometryDefine some constants for the API URLs¶
In this section, we define the relevant constants, holding the URL strings for the different endpoints.
# IDS
SERVICE_ID = "dedl-hook"
COLLECTION_ID = "EO.EUM.DAT.SENTINEL-3.SL_1_RBT___"
ITEM_ID = "S3B_SL_1_RBT____20240918T102643_20240918T102943_20240919T103839_0179_097_336_2160_PS2_O_NT_004"
# Core API
HDA_API_URL = "https://hda.data.destination-earth.eu"
SERVICES_URL = f"{HDA_API_URL}/services"
SERVICE_BY_ID_URL = f"{SERVICES_URL}/{SERVICE_ID}"
# STAC API
## Core
STAC_API_URL = f"{HDA_API_URL}/stac/v2"
CONFORMANCE_URL = f"{STAC_API_URL}/conformance"
## Item Search
SEARCH_URL = f"{STAC_API_URL}/search"
DOWNLOAD_URL = f"{STAC_API_URL}/download"
## Collections
COLLECTIONS_URL = f"{STAC_API_URL}/collections"
COLLECTION_BY_ID_URL = f"{COLLECTIONS_URL}/{COLLECTION_ID}"
## Items
COLLECTION_ITEMS_URL = f"{COLLECTIONS_URL}/{COLLECTION_ID}/items"
COLLECTION_ITEM_BY_ID_URL = f"{COLLECTIONS_URL}/{COLLECTION_ID}/items/{ITEM_ID}"
## HTTP Success
HTTP_SUCCESS_CODE = 200Core API¶
We can start off by requesting the HDA landing page, which provides links to the API definition, the available services (links services and service-doc) as well as the STAC API index.
response=requests.get(HDA_API_URL)
#JSON(response.json())
print(json.dumps(response.json(), indent=4)){
"title": "Destination Earth Data Lake (DEDL) HDA API",
"description": "The HDA API provides standardised and harmonised access to DestinE Data Lake datasets and services. \n\t\tThis API enables discovery, search, and access to Earth observation data from ESA, EUMETSAT, ECMWF and Copernicus holdings through STAC-compliant endpoints, as well as access to edge processing services.\n\t\tThe HDA API supports both programmatic access and interactive exploration of the data lake and services, facilitating seamless integration with user workflows and applications.",
"links": [
{
"rel": "self",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu/"
},
{
"rel": "root",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu/",
"title": "Root endpoint for DEDL API"
},
{
"rel": "related",
"type": "application/html",
"href": "https://data.destination-earth.eu",
"title": "DEDL Web Portal"
},
{
"rel": "child",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu/stac/",
"title": "DEDL STAC API"
},
{
"rel": "child",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu/stac/v2/",
"title": "DEDL STAC API V2"
},
{
"rel": "service-desc",
"type": "application/vnd.oai.openapi;version=3.0",
"href": "https://hda.data.destination-earth.eu/docs/openapi.yaml",
"title": "OpenAPI service description"
},
{
"rel": "service-doc",
"type": "application/html",
"href": "https://hda.data.destination-earth.eu/docs",
"title": "OpenAPI service documentation"
},
{
"rel": "services",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu/services",
"title": "List of available services provided by DEDL"
}
]
}
STAC API¶
The HDA is plugged to a STAC API.
The STAC API entry point is set to the /stac endpoint and provides the search capabilities provided by the DEDL STAC interface.
print(STAC_API_URL)
#JSON(requests.get(STAC_API_URL).json())
print(json.dumps(response.json(), indent=4))https://hda.data.destination-earth.eu/stac/v2
{
"title": "Destination Earth Data Lake (DEDL) HDA API",
"description": "The HDA API provides standardised and harmonised access to DestinE Data Lake datasets and services. \n\t\tThis API enables discovery, search, and access to Earth observation data from ESA, EUMETSAT, ECMWF and Copernicus holdings through STAC-compliant endpoints, as well as access to edge processing services.\n\t\tThe HDA API supports both programmatic access and interactive exploration of the data lake and services, facilitating seamless integration with user workflows and applications.",
"links": [
{
"rel": "self",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu/"
},
{
"rel": "root",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu/",
"title": "Root endpoint for DEDL API"
},
{
"rel": "related",
"type": "application/html",
"href": "https://data.destination-earth.eu",
"title": "DEDL Web Portal"
},
{
"rel": "child",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu/stac/",
"title": "DEDL STAC API"
},
{
"rel": "child",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu/stac/v2/",
"title": "DEDL STAC API V2"
},
{
"rel": "service-desc",
"type": "application/vnd.oai.openapi;version=3.0",
"href": "https://hda.data.destination-earth.eu/docs/openapi.yaml",
"title": "OpenAPI service description"
},
{
"rel": "service-doc",
"type": "application/html",
"href": "https://hda.data.destination-earth.eu/docs",
"title": "OpenAPI service documentation"
},
{
"rel": "services",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu/services",
"title": "List of available services provided by DEDL"
}
]
}
Discover DEDL Services¶
The /services endpoint will return the list of the DEDL services available for users of the platform.
print(SERVICES_URL)
#JSON(requests.get(SERVICES_URL).json())
print(json.dumps(response.json(), indent=4))https://hda.data.destination-earth.eu/services
{
"title": "Destination Earth Data Lake (DEDL) HDA API",
"description": "The HDA API provides standardised and harmonised access to DestinE Data Lake datasets and services. \n\t\tThis API enables discovery, search, and access to Earth observation data from ESA, EUMETSAT, ECMWF and Copernicus holdings through STAC-compliant endpoints, as well as access to edge processing services.\n\t\tThe HDA API supports both programmatic access and interactive exploration of the data lake and services, facilitating seamless integration with user workflows and applications.",
"links": [
{
"rel": "self",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu/"
},
{
"rel": "root",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu/",
"title": "Root endpoint for DEDL API"
},
{
"rel": "related",
"type": "application/html",
"href": "https://data.destination-earth.eu",
"title": "DEDL Web Portal"
},
{
"rel": "child",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu/stac/",
"title": "DEDL STAC API"
},
{
"rel": "child",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu/stac/v2/",
"title": "DEDL STAC API V2"
},
{
"rel": "service-desc",
"type": "application/vnd.oai.openapi;version=3.0",
"href": "https://hda.data.destination-earth.eu/docs/openapi.yaml",
"title": "OpenAPI service description"
},
{
"rel": "service-doc",
"type": "application/html",
"href": "https://hda.data.destination-earth.eu/docs",
"title": "OpenAPI service documentation"
},
{
"rel": "services",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu/services",
"title": "List of available services provided by DEDL"
}
]
}
Through the /services endpoint is also possible discover services related to a certain topic:
JSON(requests.get(SERVICES_URL,params = {"q": "dask"}).json())
print(json.dumps(requests.get(SERVICES_URL,params = {"q": "dask"}).json(), indent=4)){
"collections": [
{
"id": "dedl-stack",
"description": "A DestinE Data Lake Big Data Processing service providing hosted applications/environments such as JupyterHub, Dask/Dask Gateway, Open Data Cube in which users can bring their algorithms/code and execute them on DestinE Data Lake data.",
"title": "DEDL STACK Service",
"keywords": [
"DEDL",
"algorithm",
"code",
"Dask",
"JupyterHub"
],
"links": [
{
"rel": "parent",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu:8080/"
},
{
"rel": "root",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu:8080/"
},
{
"rel": "self",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu:8080/services/dedl-stack"
},
{
"rel": "describes",
"type": "text/html",
"href": "https://jupyter.central.data.destination-earth.eu/hub/",
"title": "Explore the STACK Service"
},
{
"rel": "describedby",
"type": "text/html",
"href": "https://destine-data-lake-docs.data.destination-earth.eu/en/latest/dedl-big-data-processing-services/Stack-service/Stack-service.html",
"title": "Learn about Stack Service"
}
],
"providers": [
{
"name": "Destination Earth Data Lake",
"roles": [
"host",
"producer"
],
"url": "https://hda.data.csgroup.space"
}
],
"assets": {
"thumbnail": {
"href": "https://platform.destine.eu/wp-content/uploads/2024/03/stack-de-01.jpg",
"title": "DEDL STACK Service",
"type": "image/jpeg"
}
},
"stac_version": "1.0.0"
}
],
"links": [
{
"rel": "root",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu:8080/"
},
{
"rel": "self",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu:8080/services?q=dask"
}
]
}
The API can also describe a specific service, identified by its serviceID (e.g. dedl-hook).
The links describes and described by contains the reference documentation.
print(SERVICE_BY_ID_URL)
#JSON(requests.get(SERVICE_BY_ID_URL).json())
print(json.dumps(requests.get(SERVICE_BY_ID_URL).json(), indent=4))https://hda.data.destination-earth.eu/services/dedl-hook
{
"id": "dedl-hook",
"description": "A DestinE Data Lake Big Data Processing service providing high level pre-defined and user-defined functions (conceptually like FaaS) that users can invoke from their applications and apply on the DestinE Data Lake data.",
"title": "DEDL Hook service",
"keywords": [
"DEDL",
"function",
"function",
"FaaS"
],
"links": [
{
"rel": "parent",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu:8080/"
},
{
"rel": "root",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu:8080/"
},
{
"rel": "self",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu:8080/services/dedl-hook"
},
{
"rel": "describes",
"type": "text/html",
"href": "https://odp.data.destination-earth.eu/odata/docs",
"title": "Explore the DEDL Hook service"
},
{
"rel": "describedby",
"type": "text/html",
"href": "https://destine-data-lake-docs.data.destination-earth.eu/en/latest/dedl-big-data-processing-services/Hook-service/Hook-service.html",
"title": "Learn about Hook Service"
}
],
"providers": [
{
"name": "Destination Earth Data Lake",
"roles": [
"host",
"producer"
],
"url": "https://hda.data.csgroup.space"
}
],
"assets": {
"thumbnail": {
"href": "https://platform.destine.eu/wp-content/uploads/2024/03/hook-de-01.jpg",
"title": "DEDL Hook service",
"type": "image/jpeg"
}
},
"stac_version": "1.0.0"
}
Discover DEDL data collections¶
The DestinE Data Lake contains more than 200 collections and provides several ways to discover and explore available datasets. Collections can be searched by topic, application domain, provider, geographic region, or temporal coverage.
HDA leverages theSTAC API Filter Extension to discover collections. This extension adds advanced filtering capabilities to the STAC API using the OGC Common Query Language 2 (CQL2), enabling users to build expressive queries based on collection metadata.
The Filter Extension supports:
CQL2-Text for GET requests
CQL2-JSON for POST requests
In the cell below, we use the Filter Extension to search for EUMETSAT collections whose title contains the word “Fire” and whose temporal coverage extends beyond June 2026.
response = requests.get(COLLECTIONS_URL,params = {"filter": "A_CONTAINS(federation:backends,'eumetsat') AND title like '%Fire%'","datetime":'2026-06-01T00:00:00Z/..'},)
JSON(response.json(), expanded=False)
#print(json.dumps(response.json(), indent=4))HDA also supports free-text search across collection metadata, enabling searches on textual fields such as the collection title and short description.
response = requests.get(COLLECTIONS_URL,params = {"q": '"Land Surface Temperature" and radiation'})
#JSON(response.json(), expanded=False)
print(json.dumps(response.json(), indent=4)){
"collections": [
{
"type": "Collection",
"title": "Daily Land Surface Temperature - Metop",
"id": "EO.EUM.DAT.METOP.LSA-002",
"description": "The EDLST (EPS Daily Land Surface Temperature) provides a composite of day-time and nigh-time retrievals of LST based on clear-sky measurements from the Advanced Very High Resolution Radiometer (AVHRR) on-board EUMETSAT polar system satellites, the Metop series.",
"links": [
{
"rel": "http://www.opengis.net/def/rel/ogc/1.0/queryables",
"type": "application/schema+json",
"href": "https://hda.data.destination-earth.eu/stac/v2/collections/EO.EUM.DAT.METOP.LSA-002/queryables",
"title": "Queryables"
},
{
"rel": "items",
"type": "application/geo+json",
"href": "https://hda.data.destination-earth.eu/stac/v2/collections/EO.EUM.DAT.METOP.LSA-002/items",
"title": "Items"
},
{
"rel": "self",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu/stac/v2/collections/EO.EUM.DAT.METOP.LSA-002",
"title": "Daily Land Surface Temperature - Metop"
},
{
"rel": "license",
"type": "application/pdf",
"href": "https://www.eumetsat.int/data-policy/eumetsat-data-policy.pdf",
"title": "EUMETSAT Data Policy"
},
{
"rel": "describedby",
"type": "text/html",
"href": "https://data.eumetsat.int/product/EO:EUM:DAT:METOP:LSA-002",
"title": "Daily Land Surface Temperature - Metop"
}
],
"assets": {
"thumbnail": {
"href": "https://user.eumetsat.int/s3/eup-strapi-media/HDF_5_LSASAF_EPS_EDLST_LSA_002_7f362eb3b1.png",
"roles": [
"thumbnail"
],
"title": "Daily Land Surface Temperature - Metop",
"type": "image/png"
}
},
"extent": {
"spatial": {
"bbox": [
[
-180,
-90,
180,
90
]
]
},
"temporal": {
"interval": [
[
"2015-01-01T00:00:00Z",
null
]
]
}
},
"license": "other",
"keywords": [
"Land",
"Land Surface Temperature",
"Level 3 Data",
"Surface Radiation Budget"
],
"summaries": {
"constellation": [
"METOP"
],
"federation:backends": [
"eumetsat"
],
"instruments": [
"AVHRR"
],
"platform": [
"METOP-A",
"METOP-B",
"METOP-C"
],
"processing:level": [
"L3"
]
},
"stac_version": "1.1.0",
"stac_extensions": [
"https://stac-extensions.github.io/timestamps/v1.1.0/schema.json",
"https://stac-extensions.github.io/processing/v1.2.0/schema.json"
],
"providers": [
{
"name": "European Organisation for the Exploitation of Meteorological Satellites (EUMETSAT)",
"roles": [
"producer",
"processor",
"licensor",
"host"
],
"url": "https://www.eumetsat.int/"
}
],
"created": "2024-05-16T20:42:11Z",
"updated": "2026-05-06T10:04:22Z",
"published": "2024-05-16T20:42:11Z",
"dedl:short_description": "The EDLST product offers daily land surface temperature composites derived from daytime and nighttime AVHRR clear-sky measurements aboard Metop satellites."
}
],
"links": [
{
"rel": "root",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu/stac/v2/",
"title": "DEDL HDA STAC API"
},
{
"rel": "self",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu/stac/v2/collections?q=%22Land+Surface+Temperature%22+and+radiation",
"title": "Current Page"
}
]
}
import json
import os
from getpass import getpass
import destinelab as deauth
DESP_USERNAME = input("Please input your DESP username or email: ")
DESP_PASSWORD = getpass("Please input your DESP password: ")
auth = deauth.AuthHandler(DESP_USERNAME, DESP_PASSWORD)
access_token = auth.get_token()
if access_token is not None:
print("DEDL/DESP Access Token Obtained Successfully")
else:
print("Failed to Obtain DEDL/DESP Access Token")
auth_headers = {"Authorization": f"Bearer {access_token}"}Please input your DESP username or email: eum-dedl-user
Please input your DESP password: ········
DEDL/DESP Access Token Obtained Successfully
Response code: 200
DEDL/DESP Access Token Obtained Successfully
Search¶
List Available Collections¶
The /stac/collections endpoint returns a FeatureCollection object, listing all STAC collections available to the user.
print(COLLECTIONS_URL)
JSON(requests.get(COLLECTIONS_URL).json())By providing a specific collectionID (e.g. EO.EUM.DAT.SENTINEL-3.SL_1_RBT___), the user can get the metadata for a specific Collection.
The collection used for this tutorial is SLSTR Level 1B Radiances and Brightness Temperatures - Sentinel-3
print(COLLECTION_BY_ID_URL)
#JSON(requests.get(COLLECTION_BY_ID_URL).json())
print(json.dumps(requests.get(COLLECTION_BY_ID_URL).json(), indent=4))https://hda.data.destination-earth.eu/stac/v2/collections/EO.EUM.DAT.SENTINEL-3.SL_1_RBT___
{
"id": "EO.EUM.DAT.SENTINEL-3.SL_1_RBT___",
"description": "The SLSTR level 1 products contain: the radiances of the 6 visible (VIS), Near Infra-Red (NIR) and Short Wave Infra-Red (SWIR) bands (on the A and B stripe grids); the Brightness Temperature (BT) for the 3 Thermal Infra-Red (TIR) bands; the BT for the 2 Fire (FIR) bands. Resolution: 1km at nadir (TIR), 500m (VIS). All are provided for both the oblique and nadir view. These measurements are accompanied with grid and time information, quality flags, error estimates and meteorological auxiliary data.\n\n- All Sentinel-3 NRT products are available at pick-up point in less than 3h\n- All Sentinel-3 Non Time Critical (NTC) products are available at pick-up point in less than 30 days.\nSentinel-3 is part of a series of Sentinel satellites, under the umbrella of the EU Copernicus programme.",
"stac_version": "1.1.0",
"links": [
{
"rel": "http://www.opengis.net/def/rel/ogc/1.0/queryables",
"type": "application/schema+json",
"href": "https://hda.data.destination-earth.eu/stac/v2/collections/EO.EUM.DAT.SENTINEL-3.SL_1_RBT___/queryables",
"title": "Queryables"
},
{
"rel": "items",
"type": "application/geo+json",
"href": "https://hda.data.destination-earth.eu/stac/v2/collections/EO.EUM.DAT.SENTINEL-3.SL_1_RBT___/items",
"title": "Items"
},
{
"rel": "self",
"type": "application/json",
"href": "https://hda.data.destination-earth.eu/stac/v2/collections/EO.EUM.DAT.SENTINEL-3.SL_1_RBT___",
"title": "SLSTR Level 1B Radiances and Brightness Temperatures - Sentinel-3"
},
{
"href": "https://www.eumetsat.int/data-policy/eumetsat-data-policy.pdf",
"rel": "license",
"type": "application/pdf",
"title": "EUMETSAT Data Policy"
},
{
"href": "https://data.eumetsat.int/product/EO:EUM:DAT:0411",
"rel": "describedby",
"type": "text/html",
"title": "SLSTR Level 1B Radiances and Brightness Temperatures - Sentinel-3"
}
],
"stac_extensions": [
"https://stac-extensions.github.io/eo/v1.1.0/schema.json",
"https://stac-extensions.github.io/processing/v1.2.0/schema.json",
"https://stac-extensions.github.io/timestamps/v1.1.0/schema.json"
],
"title": "SLSTR Level 1B Radiances and Brightness Temperatures - Sentinel-3",
"type": "Collection",
"assets": {
"thumbnail": {
"href": "https://user.eumetsat.int/s3/eup-strapi-media/s3_slstr_1_98197fa184.png",
"type": "image/png",
"title": "SLSTR Level 1B",
"roles": [
"thumbnail"
]
}
},
"license": "other",
"extent": {
"spatial": {
"bbox": [
[
-180,
-90,
180,
90
]
]
},
"temporal": {
"interval": [
[
"2016-04-19T00:00:00Z",
null
]
]
}
},
"keywords": [
"Level 1 Data",
"Ocean",
"Sea Surface Temperature"
],
"providers": [
{
"name": "European Organisation for the Exploitation of Meteorological Satellites (EUMETSAT)",
"description": null,
"roles": [
"producer",
"processor",
"licensor",
"host"
],
"url": "https://www.eumetsat.int/"
}
],
"summaries": {
"constellation": [
"Sentinel-3"
],
"instruments": [
"SLSTR"
],
"platform": [
"Sentinel-3A",
"Sentinel-3B"
],
"processing:level": [
"L1B"
],
"federation:backends": [
"eumetsat",
"external_fdp",
"creodias",
"wekeo_main"
]
},
"federation": {
"creodias": {
"title": "creodias",
"status": "online",
"last_status_check": "2026-07-21T00:11:35Z",
"last_successful_check": "2026-07-21T00:11:35Z"
},
"eumetsat": {
"title": "eumetsat",
"status": "online",
"last_status_check": "2026-07-21T00:46:38Z",
"last_successful_check": "2026-07-21T00:46:38Z"
},
"wekeo_main": {
"title": "wekeo_main",
"status": "offline",
"last_status_check": "2026-07-20T23:45:31Z",
"last_successful_check": null
},
"external_fdp": {
"title": "external_fdp",
"status": "online",
"last_status_check": "2026-07-20T23:02:04Z",
"last_successful_check": "2026-07-20T23:02:04Z"
}
},
"created": "2023-08-11T18:04:28Z",
"updated": "2026-05-06T10:04:22Z",
"published": "2023-08-11T18:04:28Z",
"item_assets": {
"thumbnail": {
"type": "image/png",
"roles": [
"thumbnail"
],
"title": "Preview Image",
"description": "An averaged, decimated preview image in PNG format. Single polarisation products are represented with a grey scale image. Dual polarisation products are represented by a single composite colour image in RGB with the red channel (R) representing the co-polarisation VV or HH), the green channel (G) represents the cross-polarisation (VH or HV) and the blue channel (B) represents the ratio of the cross an co-polarisations."
}
},
"dedl:short_description": "The SLSTR Level 1B product contains radiance values from six optical bands and brightness temperatures from three thermal infrared and two fire radiation bands across various resolutions and viewing angles along with accompanying metadata."
}
Search for Items in a specific collection¶
It is also possible to retrieve the list of items available within a given Collection using a simple search, sort the results, and limit the response to the first three items.
FILTER = "?datetime=2024-09-18T00:00:00Z/2024-09-20T23:59:59Z&bbox=-10,34,-5,42.5&sortby=datetime&limit=3"
print(COLLECTION_ITEMS_URL+FILTER)
response=requests.get(COLLECTION_ITEMS_URL+FILTER, headers=auth_headers)
JSON(response.json()) The search endpoint¶
The STAC API also provides an item endpoint (/stac/search).
This endpoint allows users to efficiently search for items that match the specified input filters.
By default, the /stac/search endpoint will return the first 20 items found in all the collections available at the /stac/collections endpoint.
Filters can be added either via query parameters in a GET request or added to the JSON body of a POST request.
The full detail for each available filter is available in the API documentation.
The query parameters are added at the end of the URL as a query string: ?param1=val1¶m2=val2¶m3=val3
FILTER = "&datetime=2024-09-18T00:00:00Z/2024-09-20T23:59:59Z&bbox=-10,34,-5,42.5&sortby=datetime&limit=3"
SEARCH_QUERY_STRING = "?collections="+COLLECTION_ID+FILTER
response=requests.get(SEARCH_URL + SEARCH_QUERY_STRING, headers=auth_headers)
JSON(response.json()) The same filters can be added as the JSON body of a POST request.
BODY = {
"collections": [
COLLECTION_ID,
],
"datetime" : "2024-09-18T00:00:00Z/2024-09-20T23:59:59Z",
"bbox": [-10,34,
-5,42.5 ],
"sortby": [{"field": "datetime","direction": "desc"}
],
"limit": 3,
}
response=requests.post(SEARCH_URL, json=BODY, headers=auth_headers)
JSON(response.json()) Visualize¶
Visualize search results in a table¶
Search results can be visualized on a map.
df = geopandas.GeoDataFrame.from_features(response.json()['features'], crs="epsg:4326")
df.head()Visualize search results in a map¶
#map1 = folium.Map([38, 0],
# zoom_start=4, tiles='Esri Ocean Basemap', attr='Tiles © Esri — Source: Esri, DeLorme, NAVTEQ')
#map1 = folium.Map([38, 0],zoom_start=4)
map1 = folium.Map([38, 0],zoom_start=4, tiles=None)
nasa_wms = folium.WmsTileLayer(
url='https://gibs.earthdata.nasa.gov/wms/epsg4326/best/wms.cgi',
name='NASA Blue Marble',
layers='BlueMarble_ShadedRelief',
format='image/png',
transparent=True,
attr='NASA'
)
nasa_wms.add_to(map1)
results=folium.GeoJson( response.json(),name='Search results',style_function=lambda feature: {
"fillColor": "#005577",
"color": "black",
"weight": 1
})
results.add_to(map1)
bbox=[-10,34,-5,42.5]
bb=folium.GeoJson(
shapely.geometry.box(*bbox),name='Search bounding box',style_function=lambda feature: {
"fillColor": "#ff0000",
"color": "black",
"weight": 2,
"dashArray": "5, 5",
}
)
bb.add_to(map1)
# Add layer control to toggle visibility
folium.LayerControl().add_to(map1)
#display(fig)
map1
Download¶
The items belonging to a specific collection can be downloaded entirely, or it is possible to download a single asset of a chosen item.
Download a specific item¶
To get the metadata specific to a given item (identified by its itemID in a collection, the user can request the /stac/collections/{collectionID}/items/{itemID}endpoint.
print(COLLECTION_ITEM_BY_ID_URL)
response=requests.get(COLLECTION_ITEM_BY_ID_URL, headers=auth_headers)
JSON(response.json())
#print(json.dumps(response.json(), indent=4))The metadata of a given item contains also the download link that the user can use to download a specific item.
result = json.loads(response.text)
downloadUrl = result['assets']['downloadLink']['href']
print(downloadUrl)
resp_dl = requests.get(downloadUrl,stream=True,headers=auth_headers)
# If the request was successful, download the file
if (resp_dl.status_code == HTTP_SUCCESS_CODE):
print("Downloading "+ ITEM_ID + "...")
filename = ITEM_ID + ".zip"
with open(filename, 'wb') as f:
for chunk in resp_dl.iter_content(chunk_size=1024):
if chunk:
f.write(chunk)
f.flush()
print("The dataset has been downloaded to: {}".format(filename))
else: print("Request Unsuccessful! Error-Code: {}".format(response.status_code))https://hda-download.marenostrum.data.destination-earth.eu/data/external_fdp/EO.EUM.DAT.SENTINEL-3.SL_1_RBT___/S3B_SL_1_RBT____20240918T102643_20240918T102943_20240919T103839_0179_097_336_2160_PS2_O_NT_004/downloadLink
Downloading S3B_SL_1_RBT____20240918T102643_20240918T102943_20240919T103839_0179_097_336_2160_PS2_O_NT_004...
The dataset has been downloaded to: S3B_SL_1_RBT____20240918T102643_20240918T102943_20240919T103839_0179_097_336_2160_PS2_O_NT_004.zip
Download a specific asset of an item¶
The metadata of a given item contains also the single assets download link, that the user can use to download a specific asset of the chosen item. In the example below we download the asset: “xfdumanifest.xml”
downloadUrl = result['assets']['xfdumanifest.xml']['href']
print(downloadUrl)
resp_dl = requests.get(downloadUrl,stream=True,headers=auth_headers)
# If the request was successful, download the file
if (resp_dl.status_code == HTTP_SUCCESS_CODE):
print("Downloading "+ result['assets']['xfdumanifest.xml']['title'] + "...")
filename = result['assets']['xfdumanifest.xml']['title']
with open(filename, 'wb') as f:
for chunk in resp_dl.iter_content(chunk_size=1024):
if chunk:
f.write(chunk)
f.flush()
print("The dataset has been downloaded to: {}".format(filename))
else: print("Request Unsuccessful! Error-Code: {}".format(response.status_code))https://hda-download.marenostrum.data.destination-earth.eu/data/external_fdp/EO.EUM.DAT.SENTINEL-3.SL_1_RBT___/S3B_SL_1_RBT____20240918T102643_20240918T102943_20240919T103839_0179_097_336_2160_PS2_O_NT_004/xfdumanifest.xml
Downloading xfdumanifest.xml...
The dataset has been downloaded to: xfdumanifest.xml
Visualize the quicklook asset¶
url =result['assets']["quicklook.jpg"]["href"]
headers = {
"Authorization": "Bearer " + access_token
}
response = requests.get(url, headers=headers)
response.raise_for_status()
Image(data=response.content,width=500)