Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How best to serve the assets described in the assets link #198

Closed
allanfrankwork opened this issue Aug 18, 2021 · 3 comments
Closed

How best to serve the assets described in the assets link #198

allanfrankwork opened this issue Aug 18, 2021 · 3 comments

Comments

@allanfrankwork
Copy link

Hi

I have a question on how best to serve the resources pointed to in the assets section of a STAC item. The examples I could find all link outside of the STAC API site itself (for example to s3) but I'd like to keep the STAC API service and the assert download service in the same place/site.

What I'd like to do would be something along the lines of:

https://example.com/v0/collections/collectioname/items/itemid:
"assets": {
...
"something": {
"href": "https://example.com/v0/download/itemid",
...

The /download/ url would simply serve the file with the given itemid. I would expect that this url should be listed in the openAPI spec (Swagger) since its part of the service, but not linked from anywhere else than as an asset since its only interresting for downloading an asset.

Can you see any problems with this approach or is there a better way of doing it? Do you know of any place in the OGC Feature or STAC API spec that restricts what urls a service can have outside of the ones in the spec?

Thanks!

@philvarner
Copy link
Collaborator

There are no restrictions on what URLs you can have outside the spec. If I were to do this, I'd go with a more RESTful approach of retrieving an asset by name from:

/collections/{collection_id}/items/{item_id}/assets/{asset_name}

Your example isn't quite complete (unless you only have one asset per item), since "https://example.com/v0/download/itemid" doesn't indicate which of the item's assets you wish to download.

Most services use cloud storage because it's inexpensive and has an HTTP interface that already supports useful features (if you have COGs) like range reads.

@philvarner
Copy link
Collaborator

Also, the gitter channel might be a better place for questions like this, since I don't know how many people are actually looking here.

https://gitter.im/SpatioTemporal-Asset-Catalog/Lobby

@allanfrankwork
Copy link
Author

I had not considered having the assets served under the item - that is a nice idea. I will consider using this.

In my case I really only have one asset per item so I initially considered serving the asset under

/collections/{collection_id}/items/{item_id}

but with a different content-type and linking the asset there but discarded that idea since the item and the asset are really two different entities. But I agree on your point - with multiple assets using the itemid alone would not work.

Thanks for the suggestion on gitter - I will ask there as well.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants