stac-utils / stac-rs

Tools and libraries for the SpatioTemporal Asset Catalog (STAC) specification, written in Rust
https://stac-utils.github.io/stac-rs/
Apache License 2.0
84 stars 11 forks source link

pgstacrs #523

Open gadomski opened 2 weeks ago

gadomski commented 2 weeks ago

Overview

pgstacrs will be a "full access" Python API for pgstac backed by the pgstac crate.

Prior art

Integration and goals

The plan is that pgstacrs will live "above" pypgstac and stac-fastapi-pgstac in the dependency chain:

graph LR
    pgstacrs --> pypgstac
    pgstacrs --> stac-fastapi-pgstac

To do this, pgstacrs will:

Examples

Here's some rough sketches of what pgstacrs might look like:

from pgstacrs import Client
from pystac import Collection

client = Client.open("postgresql://username:password@localhost:5432/pgstac")
print("pgstac version:", client.version())

collection = Collection.from_file(
    "https://raw.githubusercontent.com/radiantearth/stac-spec/refs/heads/master/examples/collection.json"
)
items = list(collection.get_items())
client.add_collection(collection)
client.add_items(items)

client = Client.open("postgresql://username:password@localhost:5432/pgstac", pool=True)
items = client.search(collections=["collection-id"], filter={}, intersects={}) # etc
bitner commented 2 weeks ago

Only thing that I'd modify there is that pgstacrs will expose every public pgstac function. There are a number of functions in pgstac that are purely internal.

gadomski commented 1 week ago

A note ... for the first iteration I'm going to keep things sync, at least on the Python side. If there's a strong need for async Python please yell.