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 – The spatial extent for the query as a bounding box. Example: [-180, -90, 180, 90]
datetime – The temporal extent for the query formatted as a list: [start, end].
limit – The maximum number of items to return in the query.
intersects – a geometry to filter results by geospatial intersection
collections – a list of collections to query
ids – a list of item/feature IDs to return
query – a STAC query in the format of the STAC query extension
filter – a CQL2 JSON filter
fields – 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 – a list of sortby objects, with are dicts containing ‘field’ and ‘direction’
method – GET or POST (default)
extra_params – 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 – the collection to query
bbox – The spatial extent for the query as a bounding box. Example: [-180, -90, 180, 90]
datetime – The temporal extent for the query formatted as a list: [start, end].
limit – The maximum number of items to return in the query.
extra_params – extra query parameters to pass to the api
- collection_item(collection_id, feature_id, extra_params={})[source]¶
Get a specific feature from collections/<collection_id>/items/feature_id endpoint
Get a specific feature
- Parameters
collection_id – the collection to get the item from
feature_id – The id of the feature
extra_params – extra query parameters to pass