STAC Client for Rust
A friendly, async client for the SpatioTemporal Asset Catalog (STAC) specification, written in Rust. This library helps you interact with STAC APIs to find and retrieve geospatial data.
It is inspired by Python's pystac-client but designed with Rust's principles of type safety, performance, and idiomatic API design in mind.
For architectural decisions and design rationale, see the
docs/directory.
Project Goals
- Idiomatic Rust API: Provide an API that feels natural to Rust developers, with explicit error handling and proper use of ownership.
- Minimal Dependencies: Keep the dependency tree small to ensure fast builds and a lean footprint.
- Well-Documented: Offer clear and comprehensive documentation for all public APIs.
- Thoroughly Tested: Maintain a high standard of testing to guarantee stability and correctness.
Features
- Async First: Built on
tokiofor non-blocking I/O. - Strongly-Typed Models: Rust structs for all major STAC objects (
Catalog,Collection,Item, etc.). - Powerful Search: A fluent builder pattern for constructing complex search queries.
- Robust Error Handling: Distinct error types for network, parsing, and API-specific issues.
- Customizable Client: Bring your own
reqwest::Clientto configure timeouts, proxies, or custom headers.
Installation
Add stac-client to your Cargo.toml:
[]
= "0.1.0"
= { = "1.0", = ["full"] }
Quick Start
This example shows how to connect to a STAC API, retrieve the root catalog, and run a simple search.
use ;
use Error;
async
API Reference
Basic Operations
The Client provides methods for fetching core STAC objects:
# use Client;
# use Error;
#
# async
Advanced Search
The SearchBuilder allows you to construct detailed queries. The client supports both POST /search (default) and GET /search.
# use ;
# use json;
# use Error;
#
# async
Error Handling
The library returns a stac_client::Error for failed operations, allowing you to handle different failure modes.
# use ;
#
# async
Testing
This project maintains a high level of test coverage. To run the test suite:
Contributing
Contributions are welcome! We have a strict set of development standards to ensure the quality and stability of the crate. Please review:
CONTRIBUTING.md- Contribution guidelines and release processAGENTS.md- Detailed policies and best practices
All pull requests must pass formatting, linting, and test coverage checks.
License
This project is licensed under either of the following, at your option:
- Apache License, Version 2.0 (
LICENSE-APACHEor http://www.apache.org/licenses/LICENSE-2.0) - MIT license (
LICENSE-MITor http://opensource.org/licenses/MIT)