PySTAC Client is a Python package for searching SpatioTemporal Asset Catalog (STAC) APIs. It builds upon the PySTAC library by offering higher-level functionality and the ability to leverage STAC API search endpoints seamlessly. The current version is 0.9.0, with ongoing active development and regular releases.
pip install pystac-clientVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to connect to a STAC API, perform a basic item search using geographic bounding box and collection filters, and iterate through the results. It includes a placeholder for a STAC API URL, which can be overridden by an environment variable for easier testing.
Replace `search.get_all_items()` with `search.item_collection()`.
Always pass the STAC API URL directly to `Client.open('your_stac_api_url')` or as a required positional argument in the CLI.Check the STAC API's conformance (`client.conforms_to()`) for `CollectionSearch` to understand if server-side filtering is fully supported. Be mindful of potential performance implications for client-side filtering.
Always use `max_items` to limit results, or implement careful pagination/streaming logic if processing very large datasets is intended.
For complex or type-sensitive queries, use the full JSON Query Extension syntax if the server supports it, or convert property values to the expected type on the server side if possible.
Ensure custom modifier functions perform in-place modifications and explicitly return `None` (or implicitly by not having a `return` statement).
pip install pystac-client
from pystac import Asset, Item from pystac_client import Client
search = client.search(datetime="2020-01-01T00:00:00Z/2020-01-02T23:59:59Z")
client = Client.open("https://earth-search.aws.element84.com/v1")
search = client.search(
collections=["sentinel-2-l2a"], # Ensure collection exists and is correctly spelled
datetime="2020-01-01T00:00:00Z/2020-01-01T23:59:59Z", # Valid ISO 8601
bbox=[-105.78, 39.72, -105.77, 39.73], # Correct WGS84 order: min_lon, min_lat, max_lon, max_lat
limit=10
)