Search
rustac.search
async
search(
href: str,
*,
intersects: Optional[str | dict[str, Any]] = None,
ids: Optional[str | list[str]] = None,
collections: Optional[str | list[str]] = None,
max_items: Optional[int] = None,
limit: Optional[int] = None,
bbox: Optional[list[float]] = None,
datetime: Optional[str] = None,
include: Optional[str | list[str]] = None,
exclude: Optional[str | list[str]] = None,
sortby: Optional[str | list[str | dict[str, str]]] = None,
filter: Optional[str | dict[str, Any]] = None,
query: Optional[dict[str, Any]] = None,
use_duckdb: Optional[bool] = None,
**kwargs: str,
) -> list[dict[str, Any]]
Searches a STAC API server.
Parameters:
-
href(str) –The STAC API to search.
-
intersects(Optional[str | dict[str, Any]], default:None) –Searches items by performing intersection between their geometry and provided GeoJSON geometry.
-
ids(Optional[str | list[str]], default:None) –Array of Item ids to return.
-
collections(Optional[str | list[str]], default:None) –Array of one or more Collection IDs that each matching Item must be in.
-
max_items(Optional[int], default:None) –The maximum number of items to iterate through.
-
limit(Optional[int], default:None) –The page size returned from the server. Use
max_itemsto actually limit the number of items returned from this function. -
bbox(Optional[list[float]], default:None) –Requested bounding box.
-
datetime(Optional[str], default:None) –Single date+time, or a range (
/separator), formatted to RFC 3339, section 5.6. Use double dots .. for open date ranges. -
include(Optional[str | list[str]], default:None) –fields to include in the response (see the extension docs) for more on the semantics).
-
exclude(Optional[str | list[str]], default:None) –fields to exclude from the response (see the extension docs) for more on the semantics).
-
sortby(Optional[str | list[str | dict[str, str]]], default:None) –Fields by which to sort results (use
-fieldto sort descending). -
filter(Optional[str | dict[str, Any]], default:None) –CQL2 filter expression. Strings will be interpreted as cql2-text, dictionaries as cql2-json.
-
query(Optional[dict[str, Any]], default:None) –Additional filtering based on properties. It is recommended to use filter instead, if possible.
-
use_duckdb(Optional[bool], default:None) –Query with DuckDB. If None and the href has a 'parquet' or 'geoparquet' extension, will be set to True. Defaults to None.
-
kwargs(str, default:{}) –Additional parameters to pass in to the search.
Returns:
-
list[dict[str, Any]]–STAC items
Examples:
rustac.search_to
async
search_to(
outfile: str,
href: str,
*,
intersects: Optional[str | dict[str, Any]] = None,
ids: Optional[str | list[str]] = None,
collections: Optional[str | list[str]] = None,
max_items: Optional[int] = None,
limit: Optional[int] = None,
bbox: Optional[list[float]] = None,
datetime: Optional[str] = None,
include: Optional[str | list[str]] = None,
exclude: Optional[str | list[str]] = None,
sortby: Optional[str | list[str | dict[str, str]]] = None,
filter: Optional[str | dict[str, Any]] = None,
query: Optional[dict[str, Any]] = None,
format: Optional[str] = None,
options: Optional[list[Tuple[str, str]]] = None,
use_duckdb: Optional[bool] = None,
) -> int
Searches a STAC API server and saves the result to an output file.
Parameters:
-
outfile(str) –The output href. This can be a local file path, or any url scheme supported by [stac::object_store::write].
-
href(str) –The STAC API to search.
-
intersects(Optional[str | dict[str, Any]], default:None) –Searches items by performing intersection between their geometry and provided GeoJSON geometry.
-
ids(Optional[str | list[str]], default:None) –Array of Item ids to return.
-
collections(Optional[str | list[str]], default:None) –Array of one or more Collection IDs that each matching Item must be in.
-
max_items(Optional[int], default:None) –The maximum number of items to iterate through.
-
limit(Optional[int], default:None) –The page size returned from the server. Use
max_itemsto actually limit the number of items returned from this function. -
bbox(Optional[list[float]], default:None) –Requested bounding box.
-
datetime(Optional[str], default:None) –Single date+time, or a range ('/' separator), formatted to RFC 3339, section 5.6. Use double dots .. for open date ranges.
-
include(Optional[str | list[str]], default:None) –fields to include in the response (see the extension docs) for more on the semantics).
-
exclude(Optional[str | list[str]], default:None) –fields to exclude from the response (see the extension docs) for more on the semantics).
-
sortby(Optional[str | list[str | dict[str, str]]], default:None) –Fields by which to sort results (use
-fieldto sort descending). -
filter(Optional[str | dict[str, Any]], default:None) –CQL2 filter expression. Strings will be interpreted as cql2-text, dictionaries as cql2-json.
-
query(Optional[dict[str, Any]], default:None) –Additional filtering based on properties. It is recommended to use filter instead, if possible.
-
format(Optional[str], default:None) –The output format. If none, will be inferred from the outfile extension, and if that fails will fall back to compact JSON.
-
options(Optional[list[Tuple[str, str]]], default:None) –Configuration values to pass to the object store backend.
-
use_duckdb(Optional[bool], default:None) –Query with DuckDB. If None and the href has a 'parquet' or 'geoparquet' extension, will be set to True. Defaults to None.
Returns:
-
int–The number of items written
Examples: