Skip to content

Latest commit

 

History

History
71 lines (50 loc) · 2.78 KB

README.md

File metadata and controls

71 lines (50 loc) · 2.78 KB

stac-cli

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

Command Line Interface (CLI) for STAC, named stacrs.

Installation

cargo install stac-cli -F duckdb  # to use libduckdb on your system
# or
cargo install stac-cli -F duckdb-bundled  # to build libduckdb on install (slow)

Then:

# Search
$ stacrs 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
$ stacrs translate items.parquet items.ndjson
$ stacrs translate items.ndjson items.json

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

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

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

# Validate
$ stacrs validate item.json

Usage

stacrs provides the following subcommands:

  • stacrs search: searches STAC APIs and, if the duckdb feature is enabled, geoparquet files
  • stacrs serve: serves a STAC API
  • stacrs translate: converts STAC from one format to another
  • stacrs validate: validates a STAC value

Use the --help flag to see all available options for the CLI and the subcommands:

Features

This crate has three features:

  • pgstac: enable a pgstac backend for stacrs serve
  • duckdb: build with DuckDB support, which enables searching stac-geoparquet (requires DuckDB to be present on your system)
  • duckdb-bundled: bundle DuckDB by building it from source, instead of using a local installation (does not require DuckDB to be present on your system)

Tip

If you're using the duckdb feature, set DUCKDB_LIB_DIR to the directory containing your libduckdb. If you're on macos and using Homebrew, this might be export DUCKDB_LIB_DIR=/opt/homebrew/lib

Other info

This crate is part of the stac-rs monorepo, see its README for contributing and license information.