stac¶
Python Client Library for STAC.
Submodules¶
Package Contents¶
Classes¶
The STAC Catalog. |
|
The STAC Collection. |
|
The Extent object. |
|
The Provider Object. |
|
Link object. |
|
The Geometry Object. |
|
The GeoJSON Feature of a STAC Item. |
|
The GeoJSON Feature Collection of STAC Items. |
|
This class implements a Python API client wrapper for STAC. |
Attributes¶
- class stac.Catalog(data, validate=False)¶
Bases:
dictThe STAC Catalog.
- property stac_version(self)¶
- Returns
the STAC version.
- property id(self)¶
- Returns
the catalog identifier.
- property title(self)¶
- Returns
the catalog title.
- property description(self)¶
- Returns
the catalog description.
- property links(self)¶
- Returns
a list of resources in the catalog.
- property schema(self)¶
- Returns
the Catalog jsonschema.
- class stac.Collection(data, validate=False)¶
Bases:
stac.catalog.CatalogThe STAC Collection.
- property keywords(self)¶
- Returns
the Collection list of keywords.
- property version(self)¶
- Returns
the Collection version.
- property license(self)¶
- Returns
the Collection license.
- property providers(self)¶
- Returns
the Collection list of providers.
- property extent(self)¶
- Returns
the Collection extent.
- property properties(self)¶
- Returns
the Collection properties.
- property summaries(self)¶
- Returns
the Collection summaries.
- property schema(self)¶
- Returns
the Collection jsonschema.
- get_items(self, item_id=None, filter=None)¶
Retrieve items of the collection.
- Parameters
item_id (str) – (optional) a str with a STAC Item id.
filter (dict) – (optional) A dictionary with valid STAC query parameters.
- Returns
A GeoJSON FeatureCollection of STAC Items from the collection.
- _repr_html_(self)¶
HTML repr.
- class stac.Extent(data)¶
Bases:
dictThe Extent object.
- property spatial(self)¶
- Returns
the spatial extent.
- property temporal(self)¶
- Returns
the temporal extent.
- class stac.Provider(data)¶
Bases:
dictThe Provider Object.
- property name(self)¶
- Returns
the Provider name.
- property description(self)¶
- Returns
the Provider description.
- property roles(self)¶
- Returns
the Provider roles.
- property url(self)¶
- Returns
the Provider url.
- class stac.Link(data)¶
Bases:
dictLink object.
- property rel(self)¶
- Returns
the Link relation.
- property href(self)¶
- Returns
the Link url.
- property type(self)¶
- Returns
the type of the Link object.
- property title(self)¶
- Returns
the title of the Link object.
- class stac.Geometry(data)¶
Bases:
dictThe Geometry Object.
- property type(self)¶
- Returns
the Geometry type.
- property coordinates(self)¶
- Returns
the Geometry coordinates.
- class stac.Item(data, validate=False)¶
Bases:
dictThe 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.
- property links(self)¶
- 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.ItemCollection(data, validate=False)¶
Bases:
dictThe 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.
- property links(self)¶
- Returns
the Item Collection list of GeoJSON Features.
- _repr_html_(self)¶
HTML repr.
- __iter__(self)¶
Feature iterator.
- __next__(self)¶
Next Feature iterator.
- class stac.STAC(url, validate=False, access_token=None)¶
This class implements a Python API client wrapper for STAC.
See https://github.com/radiantearth/stac-spec for more information on STAC.
- Parameters
url (str) – URL for the Root STAC Catalog.
- property conformance(self)¶
Return the list of conformance classes that the server conforms to.
- property catalog(self)¶
Retrieve the available collections in the STAC Catalog.
:return list of available collections.
- property collections(self)¶
Return all available collections.
- Returns
A dict containing all collections.
- Rype
dict
- collection(self, collection_id) stac.collection.Collection¶
Return the given collection.
- Parameters
collection_id (str) – A str for a given collection_id.
- Returns
A STAC Collection.
- Return type
dict
- search(self, filter=None)¶
Retrieve Items matching a filter.
- Parameters
filter (dict) – (optional) A dictionary with valid STAC query parameters.
- Returns
A GeoJSON FeatureCollection.
- Return type
dict
- property url(self)¶
Return the STAC server instance URL.
- __repr__(self)¶
Return the string representation of a STAC object.
- _repr_html_(self)¶
HTML repr.
- __str__(self)¶
Return the string representation of a STAC object.
- stac.__version__ = 0.9.0-13¶