stac.item

STAC Item module.

Module Contents

Classes

Asset

Asset object.

Geometry

The Geometry Object.

Properties

The Properties Object.

Item

The GeoJSON Feature of a STAC Item.

ItemCollection

The GeoJSON Feature Collection of STAC Items.

class stac.item.Asset(data)

Bases: dict

Asset object.

property href(self)
Returns

the Asset href.

property title(self)
Returns

the Asset title.

property type(self)
Returns

the Asset type.

download(self, dir=None)

Download the asset to an indicated folder.

If tqdm is installed a progressbar will be shown.

Parameters

dir – Directory path to download the asset, if left None, the asset will be downloaded to the current working directory.

Returns

path to downloaded file.

class stac.item.Geometry(data)

Bases: dict

The Geometry Object.

property type(self)
Returns

the Geometry type.

property coordinates(self)
Returns

the Geometry coordinates.

class stac.item.Properties(data)

Bases: dict

The Properties Object.

property datetime(self)
Returns

the datetime property.

property license(self)
Returns

the license property.

property providers(self)
Returns

the providers property.

property title(self)
Returns

the title property.

property created(self)
Returns

the created property.

property updated(self)
Returns

the updated property.

class stac.item.Item(data, validate=False)

Bases: dict

The GeoJSON Feature of a STAC Item.

property stac_version(self)
Returns

the STAC version.

property id(self)
Returns

the Item identifier.

property type(self)
Returns

the Item type.

property bbox(self)
Returns

the Item Bounding Box.

property collection(self)
Returns

the Item Collection.

property geometry(self)
Returns

the Item Geometry.

property properties(self)
Returns

the Item properties.

Returns

the Item related links.

property assets(self)
Returns

the Item related assets.

property schema(self)
Returns

the Collection jsonschema.

_repr_html_(self)

HTML repr.

download(self, dir=None)

Download an asset given a band name.

Parameters

dir – Directory path to download the asset, if left None, the asset will be downloaded to the current working directory.

Returns

path to downloaded file.

read(self, band_name, window=None, bbox=None, crs=None)

Read an asset given a band name.

Notes

You must install the extra geo containing the rasterio and Shapely library in order to use this method:

pip install stac.py[geo]

Parameters
  • band_name (str) – Band name used in the asset

  • window (raster.windows.Window) – window crop

  • bbox (Union[str,Tuple[float],List[float],BaseGeometry]) – The bounding box

  • crs – The Coordinate Reference System

Returns

the asset as a numpy array

Return type

numpy.ndarray

class stac.item.ItemCollection(data, validate=False)

Bases: dict

The GeoJSON Feature Collection of STAC Items.

property type(self)
Returns

the Item Collection type.

property features(self)
Returns

the Item Collection list of GeoJSON Features.

Returns

the Item Collection list of GeoJSON Features.

_repr_html_(self)

HTML repr.

__iter__(self)

Feature iterator.

__next__(self)

Next Feature iterator.