sentinelhub_request

SentinelHubRequest for the Process API

Documentation: https://docs.sentinel-hub.com/api/latest/reference/

class sentinelhub.sentinelhub_request.SentinelHubRequest(evalscript, input_data, responses, bbox=None, geometry=None, size=None, resolution=None, **kwargs)[source]

Bases: sentinelhub.data_request.DataRequest

Sentinel Hub API request class

For details of certain parameters check the Process API reference.

Parameters:
  • evalscript (str) – Evalscript.
  • input_data (List[dict or InputDataDict]) – A list of input dictionary objects as described in the API reference. It can be generated with the helper function SentinelHubRequest.input_data
  • responses (List[dict]) – A list of output.responses objects as described in the API reference. It can be generated with the helper function SentinelHubRequest.output_response
  • bbox (sentinelhub.BBox) – Bounding box describing the area of interest.
  • geometry (sentinelhub.Geometry) – Geometry describing the area of interest.
  • size (Tuple[int, int]) – Size of the image.
  • resolution (Tuple[float, float]) – Resolution of the image. It has to be in units compatible with the given CRS.
  • data_folder (str) – location of the directory where the fetched data will be saved.
  • config (SHConfig or None) – A custom instance of config class to override parameters from the saved configuration.
create_request()[source]

Prepares a download request

static input_data(data_collection=None, time_interval=None, maxcc=None, mosaicking_order=None, upsampling=None, downsampling=None, other_args=None, data_source=None)[source]

Generate the input part of the Process API request body

Parameters:
  • data_collection (DataCollection) – One of supported Process API data collections.
  • time_interval ((str, str) or (datetime, datetime)) – interval with start and end date of the form YYYY-MM-DDThh:mm:ss or YYYY-MM-DD
  • maxcc (float or None) – Maximum accepted cloud coverage of an image. Float between 0.0 and 1.0. Default is 1.0.
  • mosaicking_order (str or None) – Mosaicking order, which has to be either ‘mostRecent’, ‘leastRecent’ or ‘leastCC’.
  • upsampling (str) – A type of upsampling to apply on data
  • downsampling (str) – A type of downsampling to apply on data
  • other_args – Additional dictionary of arguments. If provided, the resulting dictionary will get updated by it.
  • other_args – dict
  • data_source (DataCollection) – A deprecated alternative of data_collection
Returns:

A dictionary-like object that also contains additional attributes

Return type:

InputDataDict

static body(request_bounds, request_data, evalscript, request_output=None, other_args=None)[source]

Generate the body the Process API request body

Parameters:
  • request_bounds (dict) – A dictionary as generated by SentinelHubRequest.bounds helper method.
  • request_data (List[dict]) – A list of dictionaries as generated by SentinelHubRequest.input_data helper method.
  • evalscript (str) – Evalscript (https://docs.sentinel-hub.com/api/latest/#/Evalscript/)
  • request_output (dict) – A dictionary as generated by SentinelHubRequest.output helper method.
  • other_args – Additional dictionary of arguments. If provided, the resulting dictionary will get updated by it.
  • other_args – dict
static output_response(identifier, response_format, other_args=None)[source]

Generate an element of output.responses as described in the Process API reference.

Parameters:
  • identifier (str) – Identifier of the output response.
  • response_format (str or sentinelhub.MimeType) – A mime type of one of ‘png’, ‘json’, ‘jpeg’, ‘tiff’.
  • other_args – Additional dictionary of arguments. If provided, the resulting dictionary will get updated by it.
  • other_args – dict
static output(responses, size=None, resolution=None, other_args=None)[source]

Generate an output part of the request as described in the Process API reference

Parameters:
  • responses (List[dict]) – A list of objects in output.responses as generated by SentinelHubRequest.output_response.
  • size (Tuple[int, int]) – Size of the image.
  • resolution (Tuple[float, float]) – Resolution of the image. It has to be in units compatible with the given CRS.
  • other_args – Additional dictionary of arguments. If provided, the resulting dictionary will get updated by it.
  • other_args – dict
static bounds(bbox=None, geometry=None, other_args=None)[source]

Generate a bound part of the Process API request

Parameters:
  • bbox (sentinelhub.BBox) – Bounding box describing the area of interest.
  • geometry (sentinelhub.Geometry) – Geometry describing the area of interest.
  • other_args – Additional dictionary of arguments. If provided, the resulting dictionary will get updated by it.
  • other_args – dict
class sentinelhub.sentinelhub_request.InputDataDict(input_data_dict, *, service_url=None)[source]

Bases: dict

An input data dictionary which also holds additional attributes

Parameters:
  • input_data_dict (dict) – A normal dictionary with input parameters
  • service_url (str) – A service URL defined by a data collection