LabelSource#

class LabelSource[source]#

Bases: ABC

An interface for storage of labels for a scene.

A LabelSource is a read-only source of labels for a scene that could be backed by a file, a database, an API, etc. The difference between LabelSources and Labels can be understood by analogy to the difference between a database and result sets queried from a database.

Attributes

bbox

Bounding box applied to the source.

crs_transformer

Associated CRSTransformer.

extent

Extent of the LabelSource.

__init__()#

Methods

__init__()

get_labels([window])

Return labels overlapping with window.

set_bbox(extent)

Set self.extent to the given value.

__getitem__(key: Any) Any[source]#
Parameters

key (Any) –

Return type

Any

abstract get_labels(window: Optional[Box] = None) Labels[source]#

Return labels overlapping with window.

Parameters

window (Optional[Box]) – Box

Returns

Labels overlapping with window. If window is None, returns all labels.

Return type

Labels

abstract set_bbox(extent: Box) None[source]#

Set self.extent to the given value.

Note

This method is idempotent.

Parameters

extent (Box) – User-specified extent in pixel coordinates.

Return type

None

abstract property bbox: Box#

Bounding box applied to the source.

abstract property crs_transformer: CRSTransformer#

Associated CRSTransformer.

property extent: Box#

Extent of the LabelSource.