Example of eoAPI customization.
Documentation: https://eoapi.dev/customization/
Source Code: https://github.com/developmentseed/eoapi-devseed
This repository shows an example of how users can customize and deploy their own version of eoAPI starting from eoapi-template.
Built on stac-fastapi.pgstac application,
-
TiTilerExtension
When the
EOAPI_STAC_TITILER_ENDPOINT
environment variable is set (pointing to theraster
application) andtitiler
extension is enabled, additional endpoints will be added to the stac-fastapi application (see: stac/extension.py):/collections/{collectionId}/items/{itemId}/tilejson.json
: Return theraster
tilejson for an item/collections/{collectionId}/items/{itemId}/viewer
: Redirect to theraster
viewer
-
a simple
Search Viewer
(/index.html
)
-
HTML response output
When receiving
Accept: text/html
headers orf=html
query parameter the application will return HTML response
-
GeoJSON-Seq / csv response output
As for the HTML output, the
/search
and/items
endpoint can returnnew line
delimited GeoJSON or CSV when specifically requested by the user withAccept: application/geo+json-seq|text/csv
headers orf=geojsonseq|csv
query parameter.curl https://stac.eoapi.dev/search\?limit\=1 --header "Accept: text/csv" itemId,collectionId,gsd,quadkey,datetime,... 11_031311120101_103001010C12B000,WildFires-LosAngeles-Jan-2025,...
The dynamic tiler deployed within eoapi-devseed
is built on top of titiler-pgstac and pgstac. It enables large-scale mosaic based on the results of STAC search queries.
The service includes all the default endpoints from titiler-pgstac application and:
/
: a custom landing page with links to the different endpoints/searches/builder
: a virtual mosaic builder UI that helps create and register STAC Search queries/collections
: a secret (not in OpenAPI documentation) endpoint used in the mosaic-builder page/collections/{collection_id}/items/{item_id}/viewer
: a simple STAC Item viewer
OGC Features and Tiles API built on top of tipg.
The API will look for tables in the database's public
schema by default. We've also added three functions that connect to the pgSTAC schema:
- pg_temp.pgstac_collections_view: Simple function which returns PgSTAC Collections
- pg_temp.pgstac_hash: Return features for a specific
searchId
(hash) - pg_temp.pgstac_hash_count: Return the number of items per geometry for a specific
searchId
(hash)
The CDK code is almost similar to the one found in eoapi-template. We just added some configurations for our custom runtimes.
Before deploying the application on the cloud, you can start by exploring it with a local Docker deployment
docker compose up --watch
Once the applications are up, you'll need to add STAC Collections and Items to the PgSTAC database. If you don't have, you can use the follow the MAXAR open data demo (or get inspired by the other demos).
Then you can start exploring your dataset with:
- the STAC Metadata service http://localhost:8081
- the Raster service http://localhost:8082
- the browser UI http://localhost:8085
If you've added a vector dataset to the public
schema in the Postgres database, they will be available through the Vector service at http://localhost:8083.
- python >=3.9
- docker
- node >=14
- AWS credentials environment variables configured to point to an account.
- Optional a
config.yaml
file to override the default deployment settings defined inconfig.py
.
Install python dependencies with
uv sync --group deploy
Note
And node dependencies with
uv run npm install
Verify that the cdk
CLI is available. Since aws-cdk
is installed as a local dependency, you can use the npx
node package runner tool, that comes with npm
.
uv run npx cdk --version
First, synthesize the app
uv run npx cdk synth --all
Then, deploy
uv run npx cdk deploy --all --require-approval never