ogc

Module for working with Sentinel Hub OGC services

class sentinelhub.ogc.OgcService(config=None)[source]

Bases: object

The base class for Sentinel Hub OGC services

Parameters:config (SHConfig or None) – A custom instance of config class to override parameters from the saved configuration.
class sentinelhub.ogc.OgcImageService(**kwargs)[source]

Bases: sentinelhub.ogc.OgcService

Sentinel Hub OGC services class for providing image data

Intermediate layer between QGC-type requests (WmsRequest and WcsRequest) and the Sentinel Hub OGC (WMS and WCS) services.

Parameters:config (SHConfig or None) – A custom instance of config class to override parameters from the saved configuration.
get_request(request)[source]

Get download requests

Create a list of DownloadRequests for all Sentinel-2 acquisitions within request’s time interval and acceptable cloud coverage.

Parameters:request (OgcRequest or GeopediaRequest) – QGC-type request with specified bounding box, time interval, and cloud coverage for specific product.
Returns:list of DownloadRequests
get_url(request, *, date=None, size_x=None, size_y=None, geometry=None)[source]

Returns url to Sentinel Hub’s OGC service for the product specified by the OgcRequest and date.

Parameters:
  • request (OgcRequest or GeopediaRequest) – OGC-type request with specified bounding box, cloud coverage for specific product.
  • date (datetime.datetime or None) – acquisition date or None
  • size_x (int or str) – horizontal image dimension
  • size_y (int or str) – vertical image dimension
Returns:

dictionary with parameters

Returns:

url to Sentinel Hub’s OGC service for this product.

Return type:

str

get_base_url(request)[source]

Creates base url string.

Parameters:request (OgcRequest or GeopediaRequest) – OGC-type request with specified bounding box, cloud coverage for specific product.
Returns:base string for url to Sentinel Hub’s OGC service for this product.
Return type:str
get_dates(request)[source]

Get available Sentinel-2 acquisitions at least time_difference apart

List of all available Sentinel-2 acquisitions for given bbox with max cloud coverage and the specified time interval. When a single time is specified the request will return that specific date, if it exists. If a time range is specified the result is a list of all scenes between the specified dates conforming to the cloud coverage criteria. Most recent acquisition being first in the list.

When a time_difference threshold is set to a positive value, the function filters out all datetimes which are within the time difference. The oldest datetime is preserved, all others all deleted.

Parameters:request (WmsRequest or WcsRequest) – OGC-type request
Returns:List of dates of existing acquisitions for the given request
Return type:list(datetime.datetime) or [None]
static get_image_dimensions(request)[source]

Verifies or calculates image dimensions.

Parameters:request (WmsRequest or WcsRequest) – OGC-type request
Returns:horizontal and vertical dimensions of requested image
Return type:(int or str, int or str)
get_wfs_iterator()[source]

Returns iterator over info about all satellite tiles used for the request

Returns:Iterator of dictionaries containing info about all satellite tiles used in the request. In case of DataSource.DEM it returns None.
Return type:Iterator[dict] or None
class sentinelhub.ogc.WebFeatureService(bbox, time_interval, *, data_source=<DataSource.SENTINEL2_L1C: (<_Source.SENTINEL2: 'Sentinel-2'>, <_ProcessingLevel.L1C: 'L1C'>)>, maxcc=1.0, **kwargs)[source]

Bases: sentinelhub.ogc.OgcService

Class for interaction with Sentinel Hub WFS service

The class is an iterator over info data of all available satellite tiles for requested parameters. It collects data from Sentinel Hub service only during the first iteration. During next iterations it returns already obtained data. The data is in the order returned by Sentinel Hub WFS service.

Parameters:
  • bbox (geometry.BBox) – Bounding box of the requested image. Coordinates must be in the specified coordinate reference system.
  • time_interval ((str, str)) – interval with start and end date of the form YYYY-MM-DDThh:mm:ss or YYYY-MM-DD
  • data_source (constants.DataSource) – Source of requested satellite data. Default is Sentinel-2 L1C data.
  • maxcc (float) – Maximum accepted cloud coverage of an image. Float between 0.0 and 1.0. Default is 1.0.
  • config (SHConfig or None) – A custom instance of config class to override parameters from the saved configuration.
get_dates()[source]

Returns a list of acquisition times from tile info data

Returns:List of acquisition times in the order returned by WFS service.
Return type:list(datetime.datetime)
get_geometries()[source]

Returns a list of geometries from tile info data

Returns:List of multipolygon geometries in the order returned by WFS service.
Return type:list(shapely.geometry.MultiPolygon)
get_tiles()[source]

Returns list of tiles with tile name, date and AWS index

Returns:List of tiles in form of (tile_name, date, aws_index)
Return type:list((str, str, int))