GET STARTED WITH GEODATAHUB API

GET STARTED WITH GEODATAHUB API

1. How to search a dataset ?

curl –location ‘https://gdh-portal-prod.cnes.fr/api/search/collections’

–header ‘Content-Type: application/json’

data ‘{

    “page”: 1,

    “query”: {

         “title”:{“contains”:”oso”}       

  //”title”:{“eq”:”PEPS Sentinel-2 L1C tiles”}

        //”description”: {“contains”: “spot”}

        //”keywords”: {“contains”: “spot”}

        //”dcs:sensor”:{“in”:[“VGT”,”AVHRR”]}

        //”dcs:processingLevel”:{“eq”:”l3a”}

        //”dcs:temporalResolutionInHours”:{“gte”:700}

        //”dcs:spatialResolutionInMeters”:{“lte”:10}

        //”dcs:sensor”:{“in”:[“VGT”,”AVHRR”]}

        //”total_items”:{“lte”:50000}

        //”extent.temporal.interval”:{“in”:[“2023-02-09T00:39:19.039Z”,”2023-05-16T22:11:16.318Z”]}

    }

}’

The searchable attributes are listed here :

AttributeFormatDescriptionSyntax example
title StringTitle of the datasetPEPS Sentinel-1 Level1
keywordsStringKeywords related on the datasat[“s1″,”sentinel-1″,”l1″,”sar”,”grd”,”slc”]
dcs:sensorStringName of the sensorC-SAR
dcs:processingLevelStringProduct levelLEVEL1
dcs:temporalResolutionInHoursNumberTemporal resolution in hour of the dataset144
dcs:spatialResolutionInMetersStringSpatial resolution in meters of the dataset5
total_itemsNumberNumber of products in the dataset10
extent.temporal.intervalInterval de datesTemporal interval of the dataset[[“2023-02-09T00:39:19.039Z”,”2023-05-16T22:11:16.318Z”]]”

The “id” attribute returned in the response will be useful to find products of a dataset.

2. How to search products from a dataset ?

curl –location ‘https://gdh-portal-ci.cnes.fr/api/search/items’

–header ‘Content-Type: application/json’

data ‘{

    “page”:1,

    “limit”:10,

    “query”: {

        “datatype”:{“in”:[“PEPS_S2_L1C”]}

  //”temporal:startDate”:{“gte”:”2013-05-24T10:50:20Z”}

        //”temporal:endDate”:{“lte”:”2013-05-24T10:50:20Z”}

        //”spaceborne:orbitID” : {“gte”:195, “lte”:210}

        //”spaceborne:absoluteOrbitID”:{“gte”:29100, “lte”:29200}

        //”spaceborne:orbitDirection”:{“eq”:”Descending”}

        //”spaceborne:cloud_cover”:{“lte”:50}

        //”spaceborne:tile”:{“eq”:”T19UDU”}

        //”spaceborne:continentsID”:{“in”:[“eu”]}

        //”spaceborne:satellitePlatform”:{“in”:[“s2b”]}

    }

}’

The main searchable attributes are listed here :

AttributeFormatDescriptionSyntax example
dataTypeStringDataset of the product“PEPS_S2_L1C”
    
temporal:startDateDatedébut d’acquisition“aaaa-mm-jjThh:mm:ss.000Z”
temporal:endDateDatefin d’acquisition“aaaa-mm-jjThh:mm:ss.000Z”
spaceborne:orbitIDNombreOrbite relative 50
spaceborne:absoluteOrbitIDNombreOrbite absolue 30972
spaceborne:orbitDirectionStringDirection de l’orbite“Descending” ou “Ascending”
spaceborne:cloud_coverNombreCouverture nuageuse40
spaceborne:tileStringTuile“T01UGT”
spaceborne:continentsIDStringcode continent“AF”, “NA”, “OC”, “AN”, “AS”, “EU”, “SA”
spaceborne:satellitePlatformStringplateforme“S1A”, “S1B”, “S2A”, “S2B”

3. How to download products from GeoDataHub ?

To download data from GeoDataHub platform, an API key is required to be authentificated. To get a personal API Key, follow the next steps. If you already have an API key, go to §3.2.

3.1. Get a GeoDataHub API key

First, create an account on https://gdh-portal-prod.cnes.fr :

Then, generate your personal API key :

Keep your personal APIkey in a safe space. If you lost it, you will have to generate an other. For security reasons, the current APIKey can’t be given back later.

3.2. Download products

The GDH Search API returns JSON containing information about the products matching the search, including the product download link.

The command to get a list of downloading links is :

<CURL COMMAND> | sed ‘s/,/\n/g’ | grep download | grep zip | sed ‘s/{“href”://g’

For example :

curl -k -H “Content-Type: application/json” -X POST -d ‘{ “page”:1,”limit”:10, “query”: {“dataType”: {“in”:[“PEPS_S2_L1C”]}}}’ “https://gdh-portal-prod.cnes.fr/api/search/items” | sed ‘s/,/\n/g’ | grep download | grep zip | sed ‘s/{“href”://g’

Then, just send a curl command including your personal API key and the links provided in “assets.href” to download the products

curl -vvv -k -L -H “X-API-Key: <APIKEY> -XGET “<DOWNLOADING_LINK>” –output <OUTPUT_NAME_FILE>

For example :

curl -vvv -k -L -H “X-API-Key: $APIKEY” -XGET “https://gdh-portal-ci.cnes.fr/api/v1/rs-catalog/downloads/URN:FEATURE:DATA:gdh:b2140343-085f-33d4-b923-52d3ae9d9dd6:V1/files/ef869eed3ad7b5e0617261e6328408c5” –output S2B_MSIL1C_20230303T080809_N0509_R078_T37UGT_20230303T111244.zip

4. Notes

GeoDataHub is providing a STAC and an Opensearch API. It is recommended to use the STAC API but some old projects could be forced to use the opensearch format.

GeoDataHub is in beta version until June 2024. We know that we are not currently 100% STAC compatible but we should fix this in the coming months. In future versions, the STAC experience will be improved. Then you will be able to use standard STAC client libraries to consume the services more easily.

Search