-
Notifications
You must be signed in to change notification settings - Fork 45
Description
FIrst of all, thank you for this project.
I'm just getting started with it (using pgstac backend), and was hoping to be able to set up a hierarchical collection structure according to some of the best practices I've seen, but it appears that stac-fastapi currently only supports a flat structure (i.e., does not support collections-within-collections). Is this correct or am I just approaching it in the wrong way?
I attempted this with a POST to /collections and providing IDs like parentcollection and parentcollection/childcollection, which successfully created both collections, but seemingly at root catalog level and with no relationship to each other.
Additionally, while both are returned when listing all collections (GET /collections), the child collection is inaccessible from the collections/{collection_id} endpoint, so cannot be retrieved/updated/deleted. I also tried with url encoding (GET /collections/parentcollection%2Fchildcollection), but that also doesn't seem to work.
If nested structures or certain characters (like /) are unsupported in identifiers, I would have expected the validation to fail during the initial POST. If nested structures are intended to be supported, then it seems there is a problem with the FastAPI route configuration.
Example:
$ curl -X 'GET' \
'http://localhost:10000/collections' \
-H 'accept: application/json' | jq
{
"collections": [
{
"id": "parentcollection",
"type": "Collection",
"links": [
{
"rel": "items",
"type": "application/geo+json",
"href": "http://localhost:10000/collections/parentcollection/items"
},
{
"rel": "parent",
"type": "application/json",
"href": "http://localhost:10000/"
},
{
"rel": "root",
"type": "application/json",
"href": "http://localhost:10000/"
},
{
"rel": "self",
"type": "application/json",
"href": "http://localhost:10000/collections/parentcollection"
}
],
"title": "parentcollection",
"assets": null,
"extent": {
"spatial": {
"bbox": [
[
0,
-90,
360,
90
]
]
},
"temporal": {
"interval": [
[
null,
null
]
]
}
},
"license": "proprietary",
"keywords": null,
"providers": [
{
"url": "https://www.example.com",
"name": "Test",
"roles": [
"host",
"producer",
"processor",
"licensor"
],
"description": null
}
],
"summaries": {},
"description": "description",
"stac_version": "1.0.0",
"stac_extensions": null
},
{
"id": "parentcollection/childcollection",
"type": "Collection",
"links": [
{
"rel": "items",
"type": "application/geo+json",
"href": "http://localhost:10000/collections/parentcollection/childcollection/items"
},
{
"rel": "parent",
"type": "application/json",
"href": "http://localhost:10000/"
},
{
"rel": "root",
"type": "application/json",
"href": "http://localhost:10000/"
},
{
"rel": "self",
"type": "application/json",
"href": "http://localhost:10000/collections/parentcollection/childcollection"
}
],
"title": "parentcollection/childcollection",
"assets": null,
"extent": {
"spatial": {
"bbox": [
[
0.013488,
-89.72341099999998,
359.986566,
89.72348699999999
]
]
},
"temporal": {
"interval": [
[
"2022-01-08T00:00:00",
null
]
]
}
},
"license": "proprietary",
"keywords": null,
"providers": [
{
"url": "https://www.example.com",
"name": "Test",
"roles": [
"host",
"producer",
"processor",
"licensor"
],
"description": null
}
],
"summaries": {},
"description": "Child description",
"stac_version": "1.0.0",
"stac_extensions": null
}
],
"links": [
{
"rel": "root",
"type": "application/json",
"href": "http://localhost:10000/"
},
{
"rel": "parent",
"type": "application/json",
"href": "http://localhost:10000/"
},
{
"rel": "self",
"type": "application/json",
"href": "http://localhost:10000/collections"
}
]
}
$ curl -X 'GET' \
'http://localhost:10000/collections/parentcollection/childcollection' \
-H 'accept: application/json'
{"detail":"Not Found"}
$ curl -X 'DELETE' \
'http://localhost:10000/collections/parentcollection/childcollection' \
-H 'accept: application/json'
{"detail":"Not Found"}
$ curl -X 'GET' \
'http://localhost:10000/collections/parentcollection%2Fchildcollection' \
-H 'accept: application/json'
{"detail":"Not Found"}