stac

GitHub Workflow Status docs.rs Crates.io Crates.io Contributor Covenant

Rust implementation of the SpatioTemporal Asset Catalog (STAC) specification.

Usage

To use the library in your project:

toml [dependencies] stac = "0.5"

Examples

```rust use stac::Item;

// Creates an item from scratch. let item = Item::new("an-id");

// Reads an item from the filesystem. let item: Item = stac::read("data/simple-item.json").unwrap(); ```

Please see the documentation for more usage examples.

Features

There is one opt-in feature, reqwest, for blocking remote reads:

toml [dependencies] stac = { version = "0.4", features = ["reqwest"]}

Then:

```rust let href = "https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/simple-item.json";

[cfg(feature = "reqwest")]

let item: stac::Item = stac::read(href).unwrap(); ```

If reqwest is not enabled, stac::read will throw an error if you try to read from a url.

```rust let href = "https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/simple-item.json";

[cfg(not(feature = "reqwest"))]

let err = stac::read::(href).unwrap_err(); ```

For non-blocking IO, use the stac-async crate.