geodesic.boson.dataset.Dataset.count#
- Dataset.count(bbox=None, datetime=None, intersects=None, collections=None, ids=None, filter=None, method='POST', extra_params={})[source]#
Count items the dataset matching a particular set of filters.
- Parameters:
bbox (List | None) – The spatial extent for the query as a bounding box. Example: [-180, -90, 180, 90]
datetime (List | Tuple | None) – The temporal extent for the query formatted as a list: [start, end].
intersects (object | None) – a geometry to use in the query
collections (List[str] | None) – a list of collections to search
ids (List[str] | None) – a list of feature/item IDs to filter to
filter (CQLFilter | dict | None) – a CQL2 filter. This is supported by most datasets but will not work for others.
method (str | None) – the HTTP method - POST is default and usually should be left alone unless a server doesn’t support
extra_params (dict | None) – a dict of additional parameters that will be passed along on the request.
- Returns:
The number of items in the dataset matching the query.
- Return type:
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.
>>> import datetime >>> from geodesic.cql import CQLFilter >>> bbox = [ ... -75.552893, 39.719814, -74.778357, 40.220805 ... ] # roughly the city of Philadelphia, PA >>> date_range = (datetime.datetime(2022, 12,1), datetime.datetime(2024,12,1)) >>> ds.count( ... bbox=bbox, ... datetime=date_range, ... filter=CQLFilter.lte("properties.eo:cloud_cover", 10.0) ... )