sentinelhub.api.byoc

Module implementing an interface with Sentinel Hub Bring Your Own COG API.

class sentinelhub.api.byoc.ByocCollectionBand(source=None, band_index=None, bit_depth=8, sample_format='UINT', no_data=None, other_data=<factory>)[source]

Bases: object

Dataclass to hold BYOC collection band specification

Parameters
source: Optional[str] = None
band_index: Optional[int] = None
bit_depth: int = 8
sample_format: str = 'UINT'
no_data: Optional[float] = None
other_data: Optional[CatchAllVar]
dataclass_json_config = {'letter_case': <function camelcase>, 'undefined': Undefined.INCLUDE}
classmethod from_dict(kvs, *, infer_missing=False)
Parameters

kvs (Optional[Union[dict, list, str, int, float, bool]]) –

Return type

A

classmethod from_json(s, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw)
Parameters

s (Union[str, bytes, bytearray]) –

Return type

A

classmethod schema(*, infer_missing=False, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)
Parameters
  • infer_missing (bool) –

  • many (bool) –

  • partial (bool) –

Return type

SchemaF[A]

to_dict(encode_json=False)
Return type

Dict[str, Optional[Union[dict, list, str, int, float, bool]]]

to_json(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, indent=None, separators=None, default=None, sort_keys=False, **kw)
Parameters
Return type

str

class sentinelhub.api.byoc.ByocCollectionAdditionalData(bands=None, max_meters_per_pixel=None, max_meters_per_pixel_override=None, other_data=<factory>)[source]

Bases: object

Dataclass to hold BYOC collection additional data

Parameters
bands: Optional[Dict[str, ByocCollectionBand]] = None
max_meters_per_pixel: Optional[float] = None
max_meters_per_pixel_override: Optional[float] = None
other_data: Optional[CatchAllVar]
dataclass_json_config = {'letter_case': <function camelcase>, 'undefined': Undefined.INCLUDE}
classmethod from_dict(kvs, *, infer_missing=False)
Parameters

kvs (Optional[Union[dict, list, str, int, float, bool]]) –

Return type

A

classmethod from_json(s, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw)
Parameters

s (Union[str, bytes, bytearray]) –

Return type

A

classmethod schema(*, infer_missing=False, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)
Parameters
  • infer_missing (bool) –

  • many (bool) –

  • partial (bool) –

Return type

SchemaF[A]

to_dict(encode_json=False)
Return type

Dict[str, Optional[Union[dict, list, str, int, float, bool]]]

to_json(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, indent=None, separators=None, default=None, sort_keys=False, **kw)
Parameters
Return type

str

class sentinelhub.api.byoc.ByocCollection(name, s3_bucket, additional_data=None, collection_id=None, user_id=None, created=None, no_data=None, other_data=<factory>)[source]

Bases: BaseCollection

Dataclass to hold BYOC collection data

Parameters
additional_data: Optional[ByocCollectionAdditionalData] = None
dataclass_json_config = {'letter_case': <function camelcase>, 'undefined': Undefined.INCLUDE}
classmethod from_dict(kvs, *, infer_missing=False)
Parameters

kvs (Optional[Union[dict, list, str, int, float, bool]]) –

Return type

A

classmethod from_json(s, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw)
Parameters

s (Union[str, bytes, bytearray]) –

Return type

A

classmethod schema(*, infer_missing=False, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)
Parameters
  • infer_missing (bool) –

  • many (bool) –

  • partial (bool) –

Return type

SchemaF[A]

to_dict(encode_json=False)
Return type

Dict[str, Optional[Union[dict, list, str, int, float, bool]]]

to_json(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, indent=None, separators=None, default=None, sort_keys=False, **kw)
Parameters
Return type

str

class sentinelhub.api.byoc.ByocTile(path, status=None, tile_id=None, tile_geometry=None, cover_geometry=None, created=None, sensing_time=None, additional_data=None, other_data=<factory>)[source]

Bases: object

Dataclass to hold BYOC tile data

Parameters
path: str
status: Optional[str] = None
tile_id: Optional[str] = None
tile_geometry: Optional[Geometry] = None
cover_geometry: Optional[Geometry] = None
created: Optional[datetime] = None
sensing_time: Optional[datetime] = None
additional_data: Optional[dict] = None
other_data: Optional[CatchAllVar]
dataclass_json_config = {'letter_case': <function camelcase>, 'undefined': Undefined.INCLUDE}
classmethod from_dict(kvs, *, infer_missing=False)
Parameters

kvs (Optional[Union[dict, list, str, int, float, bool]]) –

Return type

A

classmethod from_json(s, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw)
Parameters

s (Union[str, bytes, bytearray]) –

Return type

A

classmethod schema(*, infer_missing=False, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)
Parameters
  • infer_missing (bool) –

  • many (bool) –

  • partial (bool) –

Return type

SchemaF[A]

to_dict(encode_json=False)
Return type

Dict[str, Optional[Union[dict, list, str, int, float, bool]]]

to_json(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, indent=None, separators=None, default=None, sort_keys=False, **kw)
Parameters
Return type

str

class sentinelhub.api.byoc.SentinelHubBYOC(config=None)[source]

Bases: SentinelHubService

An interface class for Sentinel Hub Bring your own COG (BYOC) API

For more info check BYOC API reference.

Parameters

config (Optional[SHConfig]) – A configuration object with required parameters sh_client_id, sh_client_secret, and sh_auth_base_url which is used for authentication and sh_base_url which defines the service deployment that will be used.

iter_collections(search=None, **kwargs)[source]

Retrieve collections

BYOC API reference

Parameters
  • search (Optional[str]) – A search query

  • kwargs (Any) – Any other request parameters

Returns

iterator over collections

Return type

SentinelHubFeatureIterator

get_collection(collection)[source]

Get collection by its id

BYOC API reference

Parameters

collection (Union[ByocCollection, DataCollection, dict, str]) – a ByocCollection, dict or collection id string

Returns

dictionary of the collection

Return type

Dict[str, Any]

create_collection(collection)[source]

Create a new collection

BYOC API reference

Parameters

collection (Union[ByocCollection, DataCollection, dict, str]) – ByocCollection object or a dictionary

Returns

dictionary of the created collection

Return type

Dict[str, Any]

update_collection(collection)[source]

Update an existing collection

BYOC API reference

Parameters

collection (Union[ByocCollection, DataCollection, dict, str]) – ByocCollection object or a dictionary

Return type

Optional[Union[Dict[str, Any], list, str, float, int]]

delete_collection(collection)[source]

Delete existing collection by its id

BYOC API reference

Parameters

collection (Union[ByocCollection, DataCollection, dict, str]) – a ByocCollection, dict or collection id string

Return type

Optional[Union[Dict[str, Any], list, str, float, int]]

copy_tiles(from_collection, to_collection)[source]

Copy tiles from one collection to another

BYOC API reference

Parameters
Return type

Optional[Union[Dict[str, Any], list, str, float, int]]

iter_tiles(collection, sort=None, path=None, **kwargs)[source]

Iterator over collection tiles

BYOC API reference

Parameters
Returns

An iterator over payloads of tiles from the collection

Return type

SentinelHubFeatureIterator

get_tile(collection, tile)[source]

Get a tile of collection

BYOC API reference

Parameters
Returns

dictionary of the tile

Return type

Dict[str, Any]

create_tile(collection, tile)[source]

Create tile within collection

BYOC API reference

Parameters
Returns

dictionary of the tile

Return type

Dict[str, Any]

update_tile(collection, tile)[source]

Update a tile within collection

BYOC API reference

Parameters
Return type

Optional[Union[Dict[str, Any], list, str, float, int]]

delete_tile(collection, tile)[source]

Delete a tile from collection

BYOC API reference

Parameters
Return type

Optional[Union[Dict[str, Any], list, str, float, int]]

reingest_tile(collection, tile)[source]

Re-ingests a tile into a collection

BYOC API reference

Parameters
Return type

Optional[Union[Dict[str, Any], list, str, float, int]]