Skip to content

stac-utils/rustac

rustac

GitHub Workflow Status Crates.io Contributor Covenant

rustac logo

The power of Rust for the STAC ecosystem

rustac is a monorepo of Rust crates for the SpatioTemporal Asset Catalog (STAC) specification. We have a Python package derived from rustac in its own repository, rustac-py. For more on the difference between rustac and rustac-py, see our docs.

Tip

We pronounce rustac "ruh-stac".

Note

Until 2025-04-17, this repository was named stac-rs. See this RFC for context on the name change.

Formats

rustac "speaks" three forms of STAC:

  • JSON: STAC is derived from GeoJSON
  • Newline-delimited JSON (ndjson): One JSON item per line, often used for bulk item loading and storage
  • stac-geoparquet: A newer specification for storing STAC items, and optionally collections

We also have interfaces to other storage backends, e.g. Postgres via pgstac.

Command line interface

Our command line interface (CLI) can query STAC APIs, validate STAC, and more. Install:

python -m pip install rustac
# or
cargo install rustac

Then:

# Search
$ rustac search https://landsatlook.usgs.gov/stac-server \
    --collections landsat-c2l2-sr \
    --intersects '{"type": "Point", "coordinates": [-105.119, 40.173]}' \
    --sortby='-properties.datetime' \
    --max-items 1000 \
    items.parquet

# Translate formats
$ rustac translate items.parquet items.ndjson
$ rustac translate items.ndjson items.json

# Migrate STAC versions
$ rustac translate item-v1.0.json item-v1.1.json --migrate

# Search stac-geoparquet (no API server required)
$ rustac search items.parquet

# Server
$ rustac serve items.parquet  # Opens a STAC API server on http://localhost:7822

# Validate
$ rustac validate item.json

Crates

This monorepo contains several crates:

Crate Description Badges
stac Core data structures and I/O docs.rs
Crates.io
stac-api Data structures for the STAC API specification docs.rs
Crates.io
stac-extensions Basic support for STAC extensions docs.rs
Crates.io
rustac Command line interface docs.rs
Crates.io
stac-server STAC API server with multiple backends docs.rs
Crates.io
pgstac Bindings for pgstac docs.rs
Crates.io
stac-duckdb Experimental client for duckdb docs.rs
Crates.io

Dependency relationships

graph TD
    stac --> stac-api
    stac --> stac-extensions
    stac --> rustac
    stac --> pgstac
    stac --> stac-duckdb
    stac --> stac-server
    stac-api --> pgstac
    stac-api --> stac-duckdb
    stac-api --> stac-server
    stac-api --> rustac
    pgstac --> stac-server
    stac-duckdb --> stac-server
    stac-server --> rustac
Loading

Note

There's one additional crate in crates, stac-derive. This is not published and is for internal use only.

Development

See CONTRIBUTING.md for information about contributing to this project. See RELEASING.md for a checklist to use when releasing a new version.

Acknowledgements

We'd like to thank @jkeifer, @parksjr, and Rob Gomez (all from @Element84) for creating the rustac logo from an AI-generated image from the prompt "a crab, a cabin, and a glass of whisky".

License

rustac is dual-licensed under both the MIT license and the Apache license (Version 2.0). See LICENSE-APACHE and LICENSE-MIT for details.