Client
Parameters
Optional dictionary of HTTP headers to include in requests.
Can be used for authentication or custom headers.
get_collection()
Parameters
Returns
get_collection_from_catalog()
Returns
open()
Parameters
The URL of the STAC API to connect to. Example: “https://planetarycomputer.microsoft.com/api/stac/v1”
Optional dictionary of HTTP headers for authentication.
Example: {“Authorization”: “Bearer token123”}
Returns
An instance of the Client class connected to the specified URL.Example usage:
Without authentication
client = Client.open(“https://planetarycomputer.microsoft.com/api/stac/v1”)With custom headers
client = Client.open( “https://example.com/stac/v1”, headers={“Authorization”: “Bearer token123”} )Using convenience methods
client = Client.open(“https://example.com/stac/v1”) client.with_basic_auth(“username”, “password”)search()
Parameters
A variable number of item IDs to filter the items.
Example: “item_id1” or [“item_id1”, “item_id2”]
A list of bounding boxes for filtering the items.
Each bounding box is represented as a list of four float values: [min_lon, min_lat, max_lon, max_lat].
Example: [[-180.0, -90.0, 180.0, 90.0]] # This bounding box covers the entire world.
Shapely geometry object(s) or WKT string(s) for spatial filtering.
Can be a single geometry, WKT string, or a list of geometries/WKT strings.
If both bbox and geometry are provided, geometry takes precedence.
Example: Polygon(…) or “POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))” or [Polygon(…), Polygon(…)]
A single datetime, RFC 3339-compliant timestamp,
or a list of date-time ranges for filtering the items. The datetime can be specified in various formats:
- “YYYY” expands to [“YYYY-01-01T00:00:00Z”, “YYYY-12-31T23:59:59.999999Z”]
- “YYYY-mm” expands to [“YYYY-mm-01T00:00:00Z”, “YYYY-mm-<last_day>T23:59:59.999999Z”]
- “YYYY-mm-dd” expands to [“YYYY-mm-ddT00:00:00Z”, “YYYY-mm-ddT23:59:59.999999Z”]
- “YYYY-mm-ddTHH:MM:SSZ” remains as [“YYYY-mm-ddTHH:MM:SSZ”, “YYYY-mm-ddTHH:MM:SSZ”]
- A list of date-time ranges can be provided for multiple intervals.
The maximum number of STAC API results to return. Supported
single-collection bbox/datetime searches follow pystac-client semantics and
trust the API’s matching behavior. Multiple bboxes are queried independently,
unioned, and deduplicated before the final result limit; extended Spark-side
filters are applied before that limit. Example: 100
If True, return the result as a Spark DataFrame instead of an iterator of PyStacItem objects.
Example: True
Returns
An iterator of PyStacItem objects or a Spark DataFrame that match the specified filters.
with_basic_auth()
Parameters
Returns
Self for method chaining.Example usage:
Standard basic auth
client = Client.open(“https://example.com/stac/v1”) client.with_basic_auth(“user”, “pass”)API key as username (common pattern)
client.with_basic_auth(“api_key_xyz”, "")Method chaining
df = Client.open(url).with_basic_auth(api_key, "").search(collection_id=“test”)with_bearer_token()
Parameters
Returns
Self for method chaining.Example usage:
Bearer token auth
client = Client.open(“https://example.com/stac/v1”) client.with_bearer_token(“your_access_token_here”)Method chaining
df = Client.open(url).with_bearer_token(token).search(collection_id=“test”)CollectionClient
Import fromsedona.spark.stac.collection_client.
Parameters
get_dataframe()
Parameters
A variable number of item IDs to filter the items.
Example: “item_id1” or [“item_id1”, “item_id2”]
A list of bounding boxes for filtering the items.
Each bounding box is represented as a list of four float values: [min_lon, min_lat, max_lon, max_lat].
Example: [[-180.0, -90.0, 180.0, 90.0]] # This bounding box covers the entire world.
Shapely geometry object(s) or WKT string(s) for spatial filtering.
Can be a single geometry, WKT string, or a list of geometries/WKT strings.
If both bbox and geometry are provided, geometry takes precedence.
Example: Polygon(…) or “POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))” or [Polygon(…), Polygon(…)]
A single datetime, RFC 3339-compliant timestamp,
or a list of date-time ranges for filtering the items.
Example: “2020-01-01T00:00:00Z” or python_datetime.datetime(2020, 1, 1) or [[“2020-01-01T00:00:00Z”, “2021-01-01T00:00:00Z”]]
The maximum number of STAC API results to return. Supported
single-collection bbox/datetime searches follow pystac-client semantics and
trust the API’s matching behavior. Multiple bboxes are queried independently,
unioned, and deduplicated before the final result limit; extended Spark-side
filters are applied before that limit.
Returns
A Spark DataFrame containing the filtered items. If no filters are provided,
the DataFrame contains all items in the collection.
Raises
RuntimeError: If there is an error loading the data or applying the filters, a RuntimeError is raised with a message indicating the failure.
get_items()
Parameters
A list of item IDs to filter the items. If not provided, no ID filtering is applied.
Shapely geometry object(s) or WKT string(s) for spatial filtering.
Can be a single geometry, WKT string, or a list of geometries/WKT strings.
If both bbox and geometry are provided, geometry takes precedence.
A single datetime, RFC 3339-compliant timestamp,
or a list of date-time ranges for filtering the items.
The maximum number of STAC API results to return. Supported
single-collection bbox/datetime searches follow pystac-client semantics and
trust the API’s matching behavior. Multiple bboxes are queried independently,
unioned, and deduplicated before the final result limit; extended Spark-side
filters are applied before that limit.
Returns
An iterator of PyStacItem objects that match the specified filters.
If no filters are provided, the iterator contains all items in the collection.
Raises
RuntimeError: If there is an error loading the data or applying the filters, a RuntimeError is raised with a message indicating the failure.
load_items_df()
get_dataframe and
get_items call it; pass None for any filter you do not need.
Parameters
Bounding boxes for filtering the items, each a list of four
floats: [min_lon, min_lat, max_lon, max_lat]. A single bounding box
can also be given as a flat list of four floats.
Shapely geometry object(s) or WKT string(s) for spatial
filtering. If both bbox and geometry are provided, geometry takes precedence.
A single datetime, a date or RFC 3339 timestamp string,
or a list of date-time ranges for filtering the items. A partial date
string such as “2020” or “2020-01” covers that whole period.
Returns
save_to_geoparquet()
Parameters
A list of item IDs to filter the items. If not provided, no ID filtering is applied.
A bounding box for filtering the items. If not provided, no spatial filtering is applied.
Shapely geometry object(s) or WKT string(s) for spatial filtering.
If both bbox and geometry are provided, geometry takes precedence.
A temporal extent that defines the
date-time range for filtering the items. If not provided, no temporal filtering is applied.
To match a single datetime, you can set the start and end datetime to the same value in the datetime.
Example: [[“2020-01-01T00:00:00Z”, “2020-01-01T00:00:00Z”]]
Raises
RuntimeError: If there is an error loading the data, applying the filters, or saving the DataFrame to Parquet format, a RuntimeError is raised with a message indicating the failure.
get_collection_url
Import fromsedona.spark.stac.collection_client.
Parameters
Returns
Raises
ValueError: If the URL does not start with ‘http’ or ‘https’ and a collection ID is provided.

