STACAPI¶
- class geodesic.stac.STACAPI(root)[source]¶
Bases:
object
- search(bbox=None, datetime=None, limit=10, intersects=None, collections=None, ids=None, query=None, filter=None, fields=None, sortby=None, method='POST', extra_params={})[source]¶
Query the search endpoint for items.
Query this service’s OGC Features or STAC API.
- Parameters
bbox (Optional[list]) – The spatial extent for the query as a bounding box. Example: [-180, -90, 180, 90]
datetime (Optional[Union[list, tuple]]) – The temporal extent for the query formatted as a list: [start, end].
limit (Union[None, int]) – The maximum number of items to return in the query.
intersects (Optional[Any]) – a geometry to filter results by geospatial intersection
collections (Optional[List[str]]) – a list of collections to query
ids (Optional[List[str]]) – a list of item/feature IDs to return
query (Optional[dict]) – a STAC query in the format of the STAC query extension
filter (Optional[dict]) – a CQL2 JSON filter
fields (Optional[dict]) – a list of fields to include/exclude. Included fields should be prefixed by ‘+’ and excluded fields by ‘-’. Alernatively, a dict with a ‘include’/’exclude’ lists may be provided
sortby (Optional[dict]) – a list of sortby objects, with are dicts containing ‘field’ and ‘direction’
method (str) – GET or POST (default)
extra_params (dict) – dictionary of extra parameters to pass to the STAC search API
- Returns
A
geodesic.stac.FeatureCollection
with all items in the dataset matching the query.
Examples
A query on the sentinel-2-l2a dataset with a given bounding box and time range. Additionally, you can apply filters on the parameters in the items.
>>> bbox = geom.bounds >>> date_range = (datetime.datetime(2020, 12,1), datetime.datetime.now()) >>> api.search( ... bbox=bbox, ... collections=['sentinel-2-l2a'], ... datetime=date_range, ... query={'properties.eo:cloud_cover': {'lte': 10}} ... )
- collection_items(collection_id, bbox=None, datetime=None, limit=10, extra_params={})[source]¶
Query the collections/<collection_id>/items endpoint for items.
Query this service’s OGC Features or STAC API.
- Parameters
collection_id (str) – the collection to query
bbox (Optional[list]) – The spatial extent for the query as a bounding box. Example: [-180, -90, 180, 90]
datetime (Optional[Union[list, tuple]]) – The temporal extent for the query formatted as a list: [start, end].
limit (Union[None, int]) – The maximum number of items to return in the query.
extra_params (dict) – extra query parameters to pass to the api