landstac.stac¶
Thin wrapper around pystac-client for querying the LandsatLook STAC API.
The LandsatLook STAC API provides access to Landsat Collection 2 metadata and assets. This wrapper simplifies common search operations while raising clear errors when requests fail.
For more information on available collections, see: https://stacindex.org/catalogs/usgs-landsat-collection-2-api#/?t=0
Classes
|
A lightweight wrapper around the LandsatLook STAC API client. |
- class landstac.stac.LandsatLookSTAC(url='https://landsatlook.usgs.gov/stac-server')[source]¶
Bases:
objectA lightweight wrapper around the LandsatLook STAC API client.
This class simplifies searches against the Landsat Collection 2 STAC catalog, allowing queries by collection, spatial geometry, temporal range, and attribute filters.
Example
>>> stac = LandsatLookSTAC() >>> items = stac.search( ... collections=["landsat-c2l2-sr"], ... intersects=geojson, ... datetime="1995-01-01/1995-12-31", ... query={"eo:cloud_cover": {"lte": 10}}, ... max_items=100, ... ) >>> len(items) 25
For an up-to-date list of available Landsat collections, visit: https://stacindex.org/catalogs/usgs-landsat-collection-2-api#/?t=0
- Parameters:
url (str)
- search(collections=None, intersects=None, datetime=None, query=None, max_items=None)[source]¶
Search the LandsatLook STAC API.
- Parameters:
collections (List[str], optional) – One or more Landsat collections to search. Example: [“landsat-c2l2-sr”].
intersects (Dict[str, Any], optional) – A GeoJSON geometry used to spatially filter results.
datetime (str, optional) – An ISO 8601 time range for filtering. Example: “1995-01-01/1995-12-31”.
query (Dict[str, Any], optional) – Additional STAC query parameters. Example: {“eo:cloud_cover”: {“lte”: 10}}.
max_items (int, optional) – Maximum number of items to return.
- Returns:
A list of STAC Item objects matching the query.
- Return type:
List[pystac.Item]
- Raises:
StacError – If the STAC search fails for any reason.