sentinelhub.api.opensearch

Module for communication with Sentinel Hub Opensearch service.

For more search parameters check service description.

exception sentinelhub.api.opensearch.TileMissingException[source]

Bases: Exception

This exception is raised when requested tile is missing at Sentinel Hub Opensearch service

sentinelhub.api.opensearch.get_tile_info_id(tile_id)[source]

Get basic information about image tile

Parameters:

tile_id (str) – original tile identification string provided by ESA (e.g. ‘S2A_OPER_MSI_L1C_TL_SGS__20160109T230542_A002870_T10UEV_N02.01’)

Returns:

dictionary with info provided by Opensearch REST service

Raises:

TileMissingException if no tile with tile ID tile_id exists

Return type:

Dict[str, Any]

sentinelhub.api.opensearch.get_tile_info(tile, time, aws_index=None, all_tiles=False)[source]

Get basic information about image tile

Parameters:
  • tile (str) – tile name (e.g. 'T10UEV')

  • time (None | str | date | Tuple[None | str | date, None | str | date]) – A single date or a time interval

  • aws_index (int | None) – index of tile on AWS

  • all_tiles (bool) – If True it will return list of all tiles otherwise only the first one

Returns:

dictionary (or list of dictionaries) with info provided by Opensearch REST service

Return type:

Dict[str, Any] | list[Dict[str, Any]]

sentinelhub.api.opensearch.get_area_info(bbox, date_interval, maxcc=None)[source]

Get information about all images from specified area and time range

Parameters:
  • bbox (BBox) – bounding box of requested area

  • date_interval (Tuple[None | str | date, None | str | date]) – a pair of time strings in ISO8601 format

  • maxcc (float | None) – filter images by maximum percentage of cloud coverage

Returns:

iterator of dictionaries containing info provided by Opensearch REST service

Return type:

list[Dict[str, Any]]

sentinelhub.api.opensearch.get_area_dates(bbox, date_interval, maxcc=None)[source]

Get list of times of existing images from specified area and time range

Parameters:
  • bbox (BBox) – bounding box of requested area

  • date_interval (Tuple[None | str | date, None | str | date]) – a pair of time strings in ISO8601 format

  • maxcc (float | None) – filter images by maximum percentage of cloud coverage

Returns:

list of time strings in ISO8601 format

Return type:

list[datetime.date]

sentinelhub.api.opensearch.reduce_by_maxcc(result_list, maxcc)[source]

Filter list image tiles by maximum cloud coverage

Parameters:
  • result_list (Iterable[Dict[str, Any]]) – list of dictionaries containing info provided by Opensearch REST service

  • maxcc (float) – filter images by maximum percentage of cloud coverage

Returns:

list of dictionaries containing info provided by Opensearch REST service

Return type:

list[Dict[str, Any]]

sentinelhub.api.opensearch.search_iter(tile_id=None, bbox=None, start_date=None, end_date=None, absolute_orbit=None, config=None)[source]

A generator function that implements OpenSearch search queries and returns results

All parameters for search are optional.

Parameters:
  • tile_id (str | None) – original tile identification string provided by ESA (e.g. ‘S2A_OPER_MSI_L1C_TL_SGS__20160109T230542_A002870_T10UEV_N02.01’)

  • bbox (BBox | None) – bounding box of requested area

  • start_date (None | str | date) – beginning of time range

  • end_date (None | str | date) – end of time range

  • absolute_orbit (int | None) – An absolute orbit number of Sentinel-2 L1C products as defined by ESA

  • config (SHConfig | None) – A custom instance of config class to override parameters from the saved configuration.

Returns:

An iterator returning dictionaries with info provided by Sentinel Hub OpenSearch REST service

Return type:

Iterator[Dict[str, Any]]