Tile ID and relative orbit number for Sentinel 2 from CatalogAPI

I have a brief question regarding the CatalogAPI on Sentinel 2 collections. Is there a way to filter for specific tile ids and orbit numbers? It appears as if only cloud cover is available as a metric, in contrast to e.g. the Sentinel 1 collection.

Best, Philipp

Hello Philipp,

The way to address this would be by using python. After retrieving the images from the selected area with Catalog API, you can filter out the scenes by tile id or relative orbit number from the string output (ID of the scenes).

Kind regards,
Lucia

Here I provide some code snippets, which will guide you to the right direction. First thing though, is to set up your python environment with the credentials. You can apply for a free trial, if you don’t have it. Here you can find a tutorial to set up your virtual environment.

Then, import the required libraries:

from sentinelhub import CRS, BBox, Geometry, DataCollection, SHConfig, SentinelHubCatalog

You can define the bounding box or load a Geojson with the selected area of your analysis. In this example, we’ll use a bounding box:

catalog = catalog = SentinelHubCatalog(config=config)

bbox = BBox(bbox=[12.44693, 41.870072, 12.541001, 41.917096], crs=CRS.WGS84)

search_iterator = catalog.search(

  DataCollection.SENTINEL2_L2A,  

  bbox=bbox,

  time=('2022-01-01', '2022-10-31'),    

)

results = list(search_iterator)

As an output you’ll have a JSON file from which you can extract only the ‘id’ of the scenes:

id_list = [i['id'] for i in results]

After that, you can easily extract the tiles of your interest. You can check this link with information about naming convention for Sentinel 2 images.

Let’s say, you want to extract the ‘T32TQM’ tiles:

T32TQM_tiles = [i for i in id_list if 'T32TQM' in i] 

So, we output the tiles that we wanted to keep. Of course, you can improve the code as you wish.

Hope you find this useful.

Lucia

1 Like

Hi Lucia,

First off, thanks for your detailed reply! Dissecting the filename as you suggest, probably works most of the time. I can see potential issues for early Sentinel 2 scenes that sometimes followed a different scheme. However, from my point of view, fundamental meta information like tile ID and orbit number should be query-able parameters in the API. It goes against the idea of a DB query to further process query results that could have already been obtained from the DB itself. Such additional query parameters are implemented in other access approaches to Sentinel data, such as the OpenAPI. Would be great if you could bring this up when new feature ideas are discussed by the development team!

Best, Philipp

Hi Philipp,

Thank you very much for your feedback. It’s very helpful for us in order to keep improving our services and provide the best user experience. We’re taking note for further improvements.

Kind regards,
Lucia

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