-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
303 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Docs | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'python-*' | ||
pull_request: | ||
paths: | ||
- python/** | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: Swatinem/rust-cache@v2 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.x | ||
- name: Install doc requirements | ||
run: pip install -r requirements-docs.txt | ||
- uses: PyO3/maturin-action@v1 | ||
with: | ||
command: build | ||
args: --manifest-path python/Cargo.toml --out dist | ||
- name: Install stacrs | ||
run: pip install stacrs --find-links dist --no-index | ||
- name: Build docs | ||
run: mkdocs build --strict | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: 'site' | ||
deploy: | ||
environment: | ||
name: "github-pages" | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
steps: | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v5 | ||
- uses: actions/download-artifact@v4 | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
Cargo.lock | ||
dist/ | ||
pyrightconfig.json | ||
site/ | ||
.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Command-line interface (CLI) | ||
|
||
The **stac-rs** command-line interface can be installed two ways. | ||
If you have Rust, use `cargo`: | ||
|
||
```shell | ||
cargo install stac-cli | ||
``` | ||
|
||
If you have Python, use `pip`: | ||
|
||
```shell | ||
pip install stacrs-cli | ||
``` | ||
|
||
!!! Note | ||
<!-- markdownlint-disable-next-line MD046 --> | ||
The PyPI version of the CLI does not contain bindings to GDAL. This | ||
shouldn't be a problem for most users, but if you're using `stacrs item | ||
image.tiff` to generate new STAC items from a raster, you'll need to install | ||
from `cargo`. | ||
|
||
The CLI is called **stacrs**: | ||
|
||
```shell | ||
stacrs --help | ||
``` | ||
|
||
For examples of using the CLI, check out the slides from [@gadomski's](https://github.com/gadomski/) 2024 FOSS4G-NA presentation [here](https://www.gadom.ski/2024-09-FOSS4G-NA-stac-rs/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../img/rustacean-and-stac-small.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../img/stac-ferris-favicon.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../img/stac-ferris.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# stac-rs | ||
|
||
![Rustacean and STAC](./img/rustacean-and-stac-small.png) | ||
|
||
Command Line Interface (CLI), Rust crates, and other libraries for the [SpatioTemporal Asset Catalog (STAC)](https://stacspec.org/) specification. | ||
|
||
## Python documentation | ||
|
||
Our Python package is named **stacrs** and its documentation is available [here](./python/index.md). | ||
|
||
## Rust documentation on docs.rs | ||
|
||
- [stac](https://docs.rs/stac): The core Rust crate | ||
- [stac-api](https://docs.rs/stac-api): Data structures for a STAC API, and a client for searching one | ||
- [stac-validate](https://docs.rs/stac-validate): Efficiently validate STAC objects with [json-schema](https://json-schema.org/) | ||
- [stac-server](https://docs.rs/stac-server): A STAC API server with multiple backends | ||
- [pgstac](https://docs.rs/pgstac): Rust bindings for [pgstac](https://github.com/stac-utils/pgstac) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# stacrs | ||
|
||
A Python package for working with [STAC](https://stacspec.org) designed to compliment existing packages such as [pystac](https://pystac.readthedocs.io) and [pystac-client](https://pystac-client.readthedocs.io). | ||
|
||
## Usage | ||
|
||
Install via **pip**: | ||
|
||
```shell | ||
pip install stacrs | ||
``` | ||
|
||
Then: | ||
|
||
```python | ||
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, | ||
) | ||
``` | ||
|
||
### pystac | ||
|
||
If [pystac](https://pystac.readthedocs.io) is present, `stacrs.pystac` provides functions that take **pystac** objects as their inputs and outputs: | ||
|
||
```python | ||
import pystac | ||
import stacrs.pystac | ||
|
||
item = pystac.read_file("item.json") | ||
stacrs.pystac.validate(item) | ||
|
||
items = list(stacrs.pystac.search(...)) | ||
``` | ||
|
||
You can install **pystac** with **stacrs** via an optional dependency: | ||
|
||
```shell | ||
pip install 'stacrs[pystac]' | ||
``` | ||
|
||
## Comparisons | ||
|
||
This package (intentionally) has limited functionality, as it is _not_ intended to be a replacement for existing Python STAC packages. | ||
[pystac](https://pystac.readthedocs.io) is a mature Python library with a significantly richer API for working with STAC objects. | ||
For querying STAC APIs, [pystac-client](https://pystac-client.readthedocs.io) 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. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
site_name: stac-rs | ||
site_url: https://stac-utils.github.io/stac-rs | ||
repo_url: https://github.com/stac-utils/stac-rs | ||
theme: | ||
name: material | ||
logo: img/stac-ferris.png | ||
icon: | ||
repo: fontawesome/brands/github | ||
favicon: img/stac-ferris-favicon.png | ||
features: | ||
- navigation.indexes | ||
palette: | ||
- media: "(prefers-color-scheme)" | ||
toggle: | ||
icon: material/brightness-auto | ||
name: Switch to light mode | ||
- media: "(prefers-color-scheme: light)" | ||
scheme: default | ||
toggle: | ||
icon: material/brightness-7 | ||
name: Switch to dark mode | ||
- media: "(prefers-color-scheme: dark)" | ||
scheme: slate | ||
toggle: | ||
icon: material/brightness-4 | ||
name: Switch to light mode | ||
|
||
nav: | ||
- Home: index.md | ||
- Python: | ||
- python/index.md | ||
- API: | ||
- python/api/index.md | ||
- migrate: python/api/migrate.md | ||
- read: python/api/read.md | ||
- search: python/api/search.md | ||
- validate: python/api/validate.md | ||
- write: python/api/write.md | ||
- pystac: python/api/pystac.md | ||
- Command-line interface: | ||
- cli/index.md | ||
plugins: | ||
- search | ||
- social | ||
- mkdocstrings: | ||
enable_inventory: true | ||
handlers: | ||
python: | ||
load_external_modules: false | ||
options: | ||
show_root_heading: true | ||
show_signature: true | ||
show_signature_annotations: true | ||
separate_signature: true | ||
markdown_extensions: | ||
- admonition | ||
- pymdownx.highlight: | ||
anchor_linenums: true | ||
line_spans: __span | ||
pygments_lang_class: true | ||
- pymdownx.inlinehilite | ||
- pymdownx.snippets | ||
- pymdownx.superfences | ||
- pymdownx.details |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,5 +70,3 @@ docs/_build/ | |
|
||
# Pyenv | ||
.python-version | ||
|
||
site |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.