Download catalog items

search_iterator in the code below finds two sentinel2 files as SAFE format (S2A_MSIL2A_20231114T110311_N0509_R094_T31UDQ_20231114T143858.SAFE and S2A_MSIL2A_20231114T110311_N0509_R094_T31UDR_20231114T143858.SAFE):

import os
import datetime
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import requests
import getpass

from sentinelhub import (
    SHConfig,
    DataCollection,
    SentinelHubCatalog,
    SentinelHubRequest,
    BBox,
    bbox_to_dimensions,
    CRS,
    MimeType,
    Geometry,
    MosaickingOrder,
)

config = SHConfig("myprofile")
aoi_coords_wgs84 = [2, 49, 2.5, 49.7]
resolution = 10
aoi_bbox = BBox(bbox=aoi_coords_wgs84, crs=CRS.WGS84)
aoi_size = bbox_to_dimensions(aoi_bbox, resolution=resolution)

print(f"Image shape at {resolution} m resolution: {aoi_size} pixels")
catalog = SentinelHubCatalog(config=config)

time_interval = "2023-11-14", "2023-11-14"
search_iterator = catalog.search(
    DataCollection.SENTINEL2_L2A,
    bbox=aoi_bbox,
    time=time_interval,
    fields={"include": ["id", "properties.datetime"], "exclude": []},
)

How can I directly download the items (two SENTINEL2 products in SAFE format) stored by search_iterator?

Hi @ah.nikfal ,

There’s a AwsProductRequest class in sentinelhub-py. Please have a look at the documentation and give it a try.

1 Like

Yes, I came across to the AWS methods. However i would like to retrieve the data directly from the main source.
Indeed before making any issue here, I check the documentation. The new API seems very sophisticated and capable. However, for such a simple task there must be a straightforward method in the API, that I’m still looking for.

Hi @ah.nikfal ,

Since you mentioned “the new API” I guess you’re referring to the new Copernicus Data Space Ecosystem? If this is the case please have a look at my colleague’s answer in this post.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.