Crate stac_client

Crate stac_client 

Source
Expand description

§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 built on tokio for async operations and reqwest for HTTP requests.

§Project Goals

  • Idiomatic Rust API: Provide an API that feels natural to Rust developers.
  • Minimal Dependencies: Keep the dependency tree small and manageable.
  • Well-Documented: Offer clear documentation for all public APIs.
  • Thoroughly Tested: Maintain high test coverage to ensure stability.

§Quick Start

use stac_client::{Client, SearchBuilder};
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let url = "https://planetarycomputer.microsoft.com/api/stac/v1";
    let client = Client::new(url)?;

    let search = SearchBuilder::new()
        .collections(vec!["sentinel-2-l2a".to_string()])
        .limit(10)
        .build();

    let results = client.search(&search).await?;
    println!("Found {} items.", results.features.len());

    Ok(())
}

§Optional Features

  • pagination: Enables the Client::search_next_page method for easy pagination.

Re-exports§

pub use client::Client;
pub use client::SearchBuilder;
pub use error::Error;
pub use error::Result;
pub use models::*;

Modules§

client
The core STAC API client and search builder. The core STAC API client and search builder.
error
Error and result types. Defines the error types and Result alias used throughout the stac-client crate.
models
STAC data models, such as Item, Collection, and Catalog. STAC data models, such as Item, Collection, and Catalog.