SearchResult#
The SearchResult class provides a convenient way to handle and manipulate search results obtained from the EODAG API. It offers various methods to filter, transform, and interact with the search results, making it easier to work with geospatial data in different formats.
Constructor#
|
An object representing a collection of |
Pagination#
|
Retrieve and iterate over the next pages of search results, if available. |
Crunch#
Use one of the following filter_* methods to filter search results using advanced criteria. These methods simplify
crunch plugins usage.
Or manually run crunch() to apply a given eodag.plugins.crunch.base.Crunch plugin.
|
Filter products by date. |
|
Filter latest products (the ones with a the highest start date) that intersect search extent. |
|
Filter Search results to get only the latest product, based on the name of the product. |
|
Filter products, retaining only those that are overlapping with the search_extent. |
|
Filter products, retaining only those whose property match criteria. |
Filter to only keep online products. |
|
|
Do some crunching with the underlying EO products. |
Conversion#
|
Builds an |
|
Builds an |
|
GeoJSON representation of SearchResult |
|
Pystac ItemCollection representation of SearchResult |
|
|
|
WKT representation of SearchResult |
Interface#
Implements the geo-interface protocol. |
- class eodag.api.search_result.SearchResult(products, number_matched=None, errors=None, search_params=None, next_page_token=None, next_page_token_key=None, raise_errors=False)[source]#
An object representing a collection of
EOProductresulting from a search.- Parameters:
products (
list[EOProduct]) – A list of products resulting from a searchnumber_matched (
int|None, default:None) – (optional) the estimated total number of matching resultserrors (
list[tuple[str,Exception]] |None, default:None) – (optional) stored errors encountered during the search. Tuple of (provider name, exception)search_params (
dict[str,Any] |None, default:None) – (optional) search parameters stored to use in paginationnext_page_token (
str|None, default:None) – (optional) next page token value to use in paginationnext_page_token_key (
str|None, default:None) – (optional) next page token key to use in paginationraise_errors (
bool|None, default:False) – (optional) whether to raise errors encountered during the search
- Variables:
data – List of products
number_matched – Estimated total number of matching results
- as_dict(skip_invalid=True)[source]#
GeoJSON representation of SearchResult
- Parameters:
skip_invalid (
bool, default:True) – Whether to skip properties whose values are not valid according to the STAC specification.- Return type:
- Returns:
The representation of a
SearchResultas a Python dict
- as_pystac_object(skip_invalid=True)[source]#
Pystac ItemCollection representation of SearchResult
- Parameters:
skip_invalid (
bool, default:True) – Whether to skip properties whose values are not valid according to the STAC specification.- Return type:
- Returns:
The representation of a
SearchResultas apystac.ItemCollection
- as_shapely_geometry_object(skip_invalid=True)[source]#
shapely.GeometryCollectionrepresentation of SearchResult- Parameters:
skip_invalid (
bool, default:True) – Whether to skip properties whose values are not valid according to the STAC specification.- Return type:
- Returns:
The representation of a
SearchResultas ashapely.GeometryCollection
- as_wkt_object(skip_invalid=True)[source]#
WKT representation of SearchResult
- Parameters:
skip_invalid (
bool, default:True) – Whether to skip properties whose values are not valid according to the STAC specification.- Return type:
- Returns:
The representation of a
SearchResultas a WKT string
- crunch(cruncher, **search_params)[source]#
Do some crunching with the underlying EO products.
- Parameters:
- Return type:
- Returns:
The result of the application of the crunching method to the EO products
- filter_date(start=None, end=None)[source]#
Filter products by date.
Allows to filter out products that are older than a start date (optional) or more recent than an end date (optional).
Applies
FilterDatecrunch.- Parameters:
- Return type:
- Returns:
The result of the application of the crunching method to the EO products
- filter_latest_by_name(name_pattern)[source]#
Filter Search results to get only the latest product, based on the name of the product.
Applies
FilterLatestByNamecrunch.- Parameters:
name_pattern (
str) – 6 digits product name pattern (tile id)- Return type:
- Returns:
The result of the application of the crunching method to the EO products
- filter_latest_intersect(geometry)[source]#
Filter latest products (the ones with a the highest start date) that intersect search extent.
Applies
FilterLatestIntersectcrunch.
- filter_online()[source]#
Filter to only keep online products.
Applies
FilterPropertycrunch fororder:status == succeeded.- Return type:
- Returns:
The result of the application of the crunching method to the EO products
- filter_overlap(geometry, minimum_overlap=0, contains=False, intersects=False, within=False)[source]#
Filter products, retaining only those that are overlapping with the search_extent.
Applies
FilterOverlapcrunch.- Parameters:
geometry (
Any) – geometry used as search extentminimum_overlap (
int, default:0) – minimal overlap percentagecontains (
bool, default:False) –Trueif product geometry contains the search areaintersects (
bool, default:False) –Trueif product geometry intersects the search areawithin (
bool, default:False) –Trueif product geometry is within the search area
- Return type:
- Returns:
The result of the application of the crunching method to the EO products
- filter_property(operator='eq', **search_property)[source]#
Filter products, retaining only those whose property match criteria.
Applies
FilterPropertycrunch.- Parameters:
- Return type:
- classmethod from_dict(feature_collection, dag=None)[source]#
Builds an
SearchResultobject from its representation as geojson- Parameters:
feature_collection (
dict[str,Any]) – A collection representing a search result.dag (
EODataAccessGateway|None, default:None) – (optional) The EODataAccessGateway instance to use for registering the products.
- Return type:
- Returns:
An eodag representation of a search result
- classmethod from_pystac(item_collection, dag=None)[source]#
Builds an
SearchResultobject from a pystac ItemCollection- Parameters:
item_collection (
ItemCollection) – Thepystac.ItemCollectioncontaining the metadata of the products.dag (
EODataAccessGateway|None, default:None) – (optional) The EODataAccessGateway instance to use for registering the products.
- Return type:
- Returns:
An eodag representation of a search result
- next_page(update=True)[source]#
Retrieve and iterate over the next pages of search results, if available.
This method uses the current search parameters and next page token to request additional results from the provider. If
updateisTrue, the currentSearchResultinstance is updated with new products and pagination information as pages are fetched.- Parameters:
update (
bool, default:True) – IfTrue, update the currentSearchResultwith new results.- Return type:
- Returns:
An iterator yielding
SearchResultobjects for each subsequent page.
Example:
>>> first_page = SearchResult([]) # result of a search >>> for new_results in first_page.next_page(): ... continue # do something with new_results