geodesic.boson.dataset.Dataset.search#
- Dataset.search(bbox=None, datetime=None, limit=10, page_size=None, intersects=None, collections=None, ids=None, filter=None, fields=None, sortby=None, output_crs=None, method='POST', return_type=None, extra_post_params={}, extra_query_params={}, extra_params={})[source]#
Search the dataset for items.
Search this service’s OGC Features or STAC API.
- 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].
limit (bool | int | None) – The maximum number of items to return in the query. If None, will page through all results
page_size (int | None) – If retrieving all items, this page size will be used for the subsequent requests
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.
fields (dict | None) – 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 (dict | None) – a list of sortby objects, which are dicts containing “field” and “direction”. Direction may be one of “asc” or “desc”. Not supported by all datasets
output_crs (str | int | None) – the coordinate reference system to use for the geometry in the results. This may be an EPSG code (e.g. 4326) or a full CRS string/URN.
method (str | None) – the HTTP method - POST is default and usually should be left alone unless a server doesn’t support
return_type (SearchReturnType | None) – the type of object to return. Either a FeatureCollection or a GeoDataFrame
extra_post_params (dict | None) – a dict of additional parameters that will be passed along in the JSON body of a POST request.
extra_query_params (dict | None) – a dict of additional parameters that will be passed along in the query string of a GET/POST request.
extra_params (dict | None) – a dict of additional parameters that will be passed along on the request. (deprecated, use extra_post_params and extra_query_params instead)
- Returns:
A GeoDataFrame with all items in the dataset matching the query.
- Return type:
geopandas.GeoDataFrame
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. The default return limit is 10. By setting the limit to None, you will get all items returned from the search.
>>> 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.search( ... bbox=bbox, ... datetime=date_range, ... filter=CQLFilter.lte("properties.eo:cloud_cover", 10.0), ... limit=None, ... )