https://github.com/stac-utils/stac-fastapi-pgstac
PgSTAC backend for stac-fastapi, the FastAPI implementation of the STAC API spec
stac-fastapi-pgstac is an HTTP interface built in FastAPI. It validates requests and data sent to a PgSTAC backend, and adds links to the returned data. All other processing and search is provided directly using PgSTAC procedural sql / plpgsql functions on the database. PgSTAC stores all collection and item records as jsonb fields exactly as they come in allowing for any custom fields to be stored and retrieved transparently.
stac-fastapi-pgstac
depends on pgstac
database schema and pypgstac
python package.
stac-fastapi-pgstac Version | pgstac |
---|---|
4.0 | >=0.8,<0.10 |
Postgres bitnami db can be deployed with helm charts/pgstac
helm upgrade --install charts/pgstac/
after deployment migrate to pgstac
Python -m venv venv
Source venv/bin/activate
python -m pip install pypgstac[psycopg]
export PGHOST='127.0.0.1'
export PGPORT='5432'
export PGUSER='quickuser'
export PGDATABASE='bcstac'
export PGPASSWORD='quickpass'
pypgstac migrate
Debugging stac-fastapi-pgstac with docker (need to figure out networking to openshift)
?
would this flag work
--add-host=host.docker.internal:host-gateway
docker build -t bc-stac-api .
docker run \
-p 8080:8080 \
--name=bc-stac-api \
--rm \
--detach \
--env-file=./.env \
bc-stac-api
Debug from inside container
docker run -it --env-file=./.env bc-stac-api bash
uvicorn stac_fastapi.pgstac.app:app --host 127.0.0.1 --port 8080
There is a Python utility as part of PgSTAC (pypgstac) that includes a migration utility. To use:
pypgstac migrate
There is a Python utility for bulk load of STAC collections and items
pypgstac load collections collection.ndjson
pypgstac load items items.json
''''