A small no-dependency Python package for STAC, using Rust under the hood.
Install via pip:
python -m pip install stacrs
Or via conda:
conda install conda-forge::stacrs
Then:
import stacrs
# Search a STAC API
items = 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=100,
)
# Write items to a stac-geoparquet file
stacrs.write("items.parquet", items)
# Read items from a stac-geoparquet file as an item collection
item_collection = stacrs.read("items.parquet")
# Use `search_to` for better performance if you know you'll be writing the items
# to a file
stacrs.search_to(
"items.parquet",
"https://landsatlook.usgs.gov/stac-server",
collections="landsat-c2l2-sr",
intersects={"type": "Point", "coordinates": [-105.119, 40.173]},
sortby="-properties.datetime",
max_items=100,
)
See the documentation for details. In particular, our example notebook demonstrates some of the more interesting features.
This package (intentionally) has limited functionality, as it is not intended to be a replacement for existing Python STAC packages.
pystac is a mature Python library with a significantly richer API for working with STAC objects.
For querying STAC APIs, pystac-client is more feature-rich than our simplistic stacrs.search
.
That being said, it is hoped that stacrs will be a nice complement to the existing Python STAC ecosystem by providing a no-dependency package with unique capabilities, such as searching directly into a stac-geoparquet file.
git clone [email protected]:gadomski/stacrs.git
cd stacrs
uv sync # This will take a little while while the Rust dependencies build
uv run pytest
See CONTRIBUTING.md for more information about contributing to this project.
stacrs is dual-licensed under both the MIT license and the Apache license (Version 2.0). See LICENSE-APACHE and LICENSE-MIT for details.