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

Browseable recommendations and Children conformance class #229

Merged
merged 34 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
67bfa4b
merge and initial catalogs and browseable
philvarner Oct 25, 2021
a7cfb08
finish browseable
philvarner Nov 8, 2021
84bc36c
add template mention
philvarner Nov 8, 2021
f12c2ad
Add Children conformance class
philvarner Nov 8, 2021
7981ce3
Merge branch 'dev' into catalogs-and-browseable
philvarner Dec 3, 2021
5beb369
fix bad merge in CHANGELOG
philvarner Dec 6, 2021
969d125
catalog graphs are not specifically acyclic
philvarner Dec 6, 2021
369ae52
remove bit about aligning with OGC standards
philvarner Dec 6, 2021
9abae23
add Children to root README
philvarner Dec 6, 2021
b568773
Merge branch 'dev' into catalogs-and-browseable
philvarner Dec 7, 2021
a40b9de
add Browseable conformance class
philvarner Dec 10, 2021
c0cda8b
update changelog with STAC API - Browseable
philvarner Dec 16, 2021
d7fbd6d
remove unused openapi file, update order of summary items in children…
philvarner Dec 16, 2021
f8d3d10
updates
philvarner Dec 16, 2021
7b6bd6f
clarify what should be returned by children
philvarner Dec 16, 2021
788be5e
update children openapi example
philvarner Dec 16, 2021
3bcf17b
clarify browseable and children
philvarner Dec 16, 2021
be01abb
wordsmithing
philvarner Dec 16, 2021
c128863
claify browseable vs. search
philvarner Dec 16, 2021
966d433
add mention of single canonical link to Item
philvarner Dec 16, 2021
491af9c
remove mention of search in the browseable landing page example
philvarner Dec 20, 2021
b6d4379
wordsmithing
philvarner Dec 20, 2021
0c8829a
wordsmithing
philvarner Dec 20, 2021
5a694d5
updates
philvarner Dec 20, 2021
5bd2d2e
Merge branch 'dev' into catalogs-and-browseable
philvarner Jan 5, 2022
caa5ef1
Update browseable/README.md
philvarner Jan 5, 2022
03200a5
add link about items link rel in features
philvarner Jan 5, 2022
4443078
add link about items link rel in features
philvarner Jan 5, 2022
d6581b4
Update core/README.md
philvarner Jan 5, 2022
f112c01
clarify browseable example
philvarner Jan 5, 2022
2a54b6a
Update core/README.md
philvarner Jan 5, 2022
435fb5a
remove sub-collection
philvarner Jan 5, 2022
8cc1642
Update core/README.md
philvarner Jan 5, 2022
5353b53
update items lang in core
philvarner Jan 5, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added `STAC API - Children` conformance class
- Added description of how to support both search and browse in an API.
- The paging mechanism via a Link with rel `next` or `prev` as defined for Item Search can also be used
for the STAC API - Features endpoint `/collections/{collection_id}/items`, as described in OAFeat.
- The paging mechanism via a Link with rel `next` or `prev` as defined for items can also be used
Expand Down Expand Up @@ -54,7 +56,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Support binding Sort, Fields, and Context Extensions to STAC Features items resource
endpoint (`/collections/{collection_id}/items`)
endpoint (`/collections/{collectionId}/items`)
- In Collections, added `canonical` rel type, added `/` and `/api` to list of endpoints
- In Item Search, added endpoint table

Expand Down
9 changes: 7 additions & 2 deletions PRINCIPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ core geospatial standards.
The collaboration facilities of Github should be used to their full extent. All proposed improvements and
changes should come in the form of pull requests, using code review functionality to discuss changes.

- **Alignment with OGC standards** - The Open Geospatial Consortium publishes a large set of geospatial standards.
philvarner marked this conversation as resolved.
Show resolved Hide resolved
To the greatest extent possible, the STAC API should align with existing and in-progress OGC API standards. The
STAC API has a symbiotic relationship with these standards, as it seeks both to reuse their building blocks and
push them forward in a practical direction.

- **JSON + REST + HTTP at the core.** JSON has won over XML, and REST over SOAP. We embrace them and
are not considering legacy options. Forward looking protocols can be considered as extensions,
but the default specifications should be in JSON, following best REST practices. HTTP caching and
error codes should be leveraged at the core. GeoJSON has already defined the core geospatial JSON response,
so it should also be core. As STAC APIs follow a RESTful model, a core principal is the use of HTTP Request Methods ("verbs") and
the `Content-Type` header to drive behavior on resources ("nouns").
so it should also be core. STAC APIs follow the modern web API practices of using HTTP Request Methods
("verbs") and the `Content-Type` header to drive behavior on resources ("nouns").

- **Small Reusable Pieces Loosely Coupled** - Each specification should be as focused as possible,
defining one core concept and refraining from describing lots of options. Additional options can be made
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

## About

The SpatioTemporal Asset Catalog (STAC) specification aims to standardize the way geospatial assets are exposed online and queried.
The SpatioTemporal Asset Catalog (STAC) family of specifications aim to standardize the way geospatial asset metadata is structured and queried.
A 'spatiotemporal asset' is any file that represents information about the earth captured in a certain space and
time. The core STAC specification lives at [gitub.com/radiantearth/stac-spec](https://github.com/radiantearth/stac-spec).
time. The core STAC specifications live at [gitub.com/radiantearth/stac-spec](https://github.com/radiantearth/stac-spec).

A STAC API is the dynamic version of a SpatioTemporal Asset Catalog. It returns a STAC [Catalog](stac-spec/catalog-spec/catalog-spec.md),
[Collection](stac-spec/collection-spec/collection-spec.md), [Item](stac-spec/item-spec/item-spec.md),
Expand All @@ -24,7 +24,7 @@ Typically, a Feature is used when returning a single Item object, and FeatureCol
JSON array of Item entities).

The API can be implemented in compliance with the *[OGC API - Features](http://docs.opengeospatial.org/is/17-069r3/17-069r3.html)* standard
(we'll use OAFeat for shorthand). In this case STAC API can be thought of as a specialized Features API
(OAFeat for shorthand). In this case STAC API can be thought of as a specialized Features API
to search STAC catalogs, where the features returned are STAC [Item](stac-spec/item-spec/item-spec.md) objects,
that have common properties, links to their assets and geometries that represent the footprints of the geospatial assets.

Expand Down Expand Up @@ -64,6 +64,9 @@ The *[ogcapi-features](ogcapi-features)* folder describes how a STAC API can ful
Features](http://docs.opengeospatial.org/is/17-069r3/17-069r3.html) to expose individual `items` endpoints for search of
each STAC collection. It also includes extensions that can be used to further enhance OAFeat.
philvarner marked this conversation as resolved.
Show resolved Hide resolved

**STAC API - Collections:**
The *[collections](collections)* folder describes how a STAC API can advertise the Collections it contains.

**Extensions:**
The *[extensions](extensions.md) document* describes how STAC incubates new functionality, and it links to the existing
extensions that can be added to enrich the functionality of a STAC API. Each has an OpenAPI yaml, but some of the yaml
Expand Down
156 changes: 156 additions & 0 deletions children/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# STAC API - Children

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are catalogs returned by this endpoint allowed to implement item search (i.e. can they have a /search endpoint)?

Copy link

@geospatial-jeff geospatial-jeff Nov 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The landing page is just a catalog, and itself implements /search, so I'm guessing this is allowed. And the /search response would only return items that are contained by the catalog (potentially across many collections).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, any (sub) Catalog can implement a search endpoint.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for bringing this up. I thought I'd explicitly mentioned this, but I can't find it, so I'll make sure to add something.


- [STAC API - Children](#stac-api---children)
- [Link Relations](#link-relations)
- [Endpoints](#endpoints)
- [Pagination](#pagination)
- [Example](#example)

- **OpenAPI specification:** [openapi.yaml](openapi.yaml) ([rendered version](https://api.stacspec.org/v1.0.0-beta.5/children))
- **Conformance URI:** <https://api.stacspec.org/v1.0.0-beta.5/children>
- **Extension [Maturity Classification](../extensions.md#extension-maturity):** Pilot
- **Dependencies**: [STAC API - Core](../core)

A STAC API can return information about all STAC [Catalogs](../stac-spec/catalog-spec/catalog-spec.md) available using a link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused if the server is expected to return just the first generation of children, the last generation of children, or the entire ancestry. For example, if I had Landsat catalogs organized as /catalogs/landsat_8_c1/{path}_{row}_{date}, the /children endpoint could:

  1. Return all {path} catalogs (immediate children).
  2. Return every combination of {path}_{row}_{date} (last generation of children).
  3. Return every combination of {path}, {path}_{row}, and {path}_{row}_{date} (entire ancestry).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... is this a conformance class a "simple" way for providers to express their "preferred list of catalogs and collections to show on a frontpage"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To answer @geospatial-jeff 's question, it's up to the implementer. I think typically it will return exactly the same set of children that have child relations from the root. The benefit to having it at this endpoint is that the title, desc, etc can all be returned, so a client doesn't have to retrieve every single child link just to find out the title to display -- this was Rob's use case.

Maybe "simple" isn't the right word. I'll think about this.

from the landing page that uses the link relation `children`, which links to an endpoint called
`/children`. The purpose of this endpoint is to present a single resource from which clients can retrieve
all the child objects (Catalogs and Collections) of a Catalog. This eliminates then need for a client to
Copy link

@geospatial-jeff geospatial-jeff Nov 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that returning both Catalogs and Collections in the /children endpoint is confusing. My understanding after reading this PR is that collections are for searching while catalogs are for browsing. It even says in the Browseable Catalogs best practices that collections should not be included as part of the browseable tree of catalogs. Allowing collections to be used for browsing is poor separation of concerns, and instead of just recommending against their use the spec should forbid using collections in this way.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is a bit confusing. Like do I not need to retrieve /collections anymore if /children is implemented? How should clients handle all the duplication to show a list of unique catalogs/collections?

Copy link
Collaborator

@lossyrob lossyrob Nov 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see the benefit of having children return both Catalogs and Collections - it more fits with the STAC core specification which uses rel=child for both of those cases. It also allows for all of the catalogs and collections to be retrieved in a single paginated call - useful for rendering the content of the API.

One addition we could make is that a query parameter can determine which type to return - e.g.

https://stac.api/children?type=catalog

Where is the best practices text you referenced located?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's included as part of https://github.com/philvarner/stac-api-spec/blob/catalogs-and-browseable/core/README.md#browseable-catalogs introduced in this PR. The exact language is:

These are the two standard ways of structuring a browseable tree of catalogs, the only difference being whether the Collection is used as part of the tree or not:

  • Catalog (root) -> Catalog* -> Item (recommended)
  • Catalog (root) -> Collection -> Catalog* -> Item

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll see if I explicitly stated it anywhere, but the intention was that /children would return the same list of entities that are linked to via rel=child from the root. The benefit (as Rob has articulated before) is that a client can get all of the entities with one call instead of having to make one HTTP request for each one to, say, only get the title of the collection or catalog.

retrieve each `child` link from the root to retrieve additional information (e.g., title, description) about the child object.

## Link Relations

The following Link relations shall exist in the Landing Page (root).

| **rel** | **href** | **From** | **Description** |
| -------------- | ----------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `root` | `/` | STAC - Core | The root URI |
| `self` | `/` | OAFeat | Self reference, same as root URI |
| `service-desc` | `/api` | OAFeat | The OpenAPI service description. Uses the `application/vnd.oai.openapi+json;version=3.0` media type to refer to the OpenAPI 3.0 document that defines the service's API. The path for this endpoint is only recommended to be `/api`, but may be another path. |
| `children` | `/children` | STAC - Children | List of children of this catalog |

A `service-doc` endpoint is recommended, but not required.

| **rel** | **href** | **From** | **Description** |
| ------------- | ----------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `service-doc` | `/api.html` | OAFeat OpenAPI | An HTML service description. Uses the `text/html` media type to refer to a human-consumable description of the service. The path for this endpoint is only recommended to be `/api.html`, but may be another path. |

The following Link relations shall exist in the `/children` endpoint response.

| **rel** | **href** | **From** | **Description** |
| ------- | ----------- | --------- | --------------- |
| `root` | `/` | STAC Core | The root URI |
| `self` | `/children` | OAFeat | Self reference |

## Endpoints

| Endpoint | Returns | Description |
| ----------- | -------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `/` | Catalog | Landing Page and root Catalog |
| `/api` | OAFeat OpenAPI | The OpenAPI service description. The path for this endpoint is only recommended to be `/api`, but may be another path. |
| `/children` | JSON | Object with a list of child Catalogs and Collections |

STAC APIs implementing the STAC API - Children class must support HTTP GET operation at `/children`, with the return JSON document consisting
of an array of all child Catalogs and Collections and an array of Links.

## Pagination

The `/children` endpoint supports a pagination mechanism that aligns with pagination as described in the
OGC API - Common - Part 2: Geospatial Data specification. This is described in detail in
the [STAC - Features Collection Pagination section](../ogcapi-features/README.md#collection-pagination).
To the greatest extent possible, the catalog should be structured such that all children can be
retrieved from the endpoint in a single call.

## Example

Below is a minimal example, but captures the essence. Each object must be a valid STAC
[Collection](../stac-spec/collection-spec/README.md) or [Catalog](../stac-spec/catalog-spec/README.md),
and each must have a `self` link that communicates its canonical location. And then
the links section must include a `self` link, and it must also link to alternate representations
(like html) of the collection.

```json
{
"children": [
{
"stac_version": "1.0.0",
"stac_extensions": [ ],
"id": "cool-data",
"title": "Cool Data from X Satellite",
"description": "A lot of awesome words describing the data",
"type": "Catalog",
"license": "CC-BY",
"extent": {
"spatial": {
"bbox": [[-135.17, 36.83, -51.24, 62.25]]
},
"temporal": {
"interval": [["2009-01-01T00:00:00Z",null]]
}
},
"links": [
{
"rel": "root",
"type": "application/json",
"href": "https://myservice.com"
},
{
"rel": "parent",
"type": "application/json",
"href": "https://myservice.com"
},
{
"rel": "self",
"type": "application/json",
"href": "https://myservice.com/catalogs/cool-data"
}
],
},
{
"stac_version": "1.0.0",
"stac_extensions": [ ],
"id": "some-other-data",
"title": "Some Other Data from Y Satellite",
"description": "More awesome words describing the data",
"type": "Catalog",
"license": "CC-BY",
"extent": {
"spatial": {
"bbox": [[-135.17, 36.83, -51.24, 62.25]]
},
"temporal": {
"interval": [["2009-01-01T00:00:00Z",null]]
}
},
"links": [
{
"rel": "root",
"type": "application/json",
"href": "https://myservice.com"
},
{
"rel": "parent",
"type": "application/json",
"href": "https://myservice.com"
},
{
"rel": "self",
"type": "application/json",
"href": "https://myservice.com/catalogs/some-other-data"
}
],
}
],
"links": [
{
"rel": "root",
"type": "application/json",
"href": "https://myservice.com"
},
{
"rel": "self",
"type": "application/json",
"href": "https://myservice.com/children"
}
]
}
```
125 changes: 125 additions & 0 deletions children/openapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
openapi: 3.0.3
info:
title: STAC API - Children
version: '1.0.0-beta.5'
description: >-
This is an OpenAPI definition of the SpatioTemporal Asset Catalog API - Children
specification.
contact:
name: STAC Specification
url: 'http://stacspec.org'
license:
name: Apache License 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0'
tags:
- name: Children
description: |-
All endpoints related to STAC API - Children
paths:
'/':
get:
tags:
- Children
summary: landing page
description: |-
The landing page provides links to the sub-resources.
operationId: getLandingPage
responses:
'200':
description: |-
The landing page provides links to the API definition
(link relations `service-desc` and `service-doc`),
the Conformance declaration (path `/conformance`,
link relation `conformance`), and the Feature
Collections (path `/collections`, link relation
`data`).
content:
application/json:
schema:
$ref: '../core/openapi.yaml#/components/schemas/landingPage'
example:
stac_version: 1.0.0-beta.5
type: Catalog
id: sentinel
title: Copernicus Sentinel Imagery
description: Catalog of Copernicus Sentinel 1 and 2 imagery.
conformsTo:
- 'https://api.stacspec.org/v1.0.0-beta.5/core'
- 'http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/core'
- 'http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/oas30'
- 'http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/geojson'
links:
- href: 'http://data.example.org/'
rel: self
type: application/json
title: this document
- href: 'http://data.example.org/api'
rel: service-desc
type: application/vnd.oai.openapi+json;version=3.0
title: the API definition
- href: 'http://data.example.org/api.html'
rel: service-doc
type: text/html
title: the API documentation
- href: 'http://data.example.org/conformance'
rel: conformance
type: application/json
title: OGC API conformance classes implemented by this server
- href: 'http://data.example.org/children'
rel: children
type: application/json
title: Child catalogs and collections of this root catalog
'/children':
get:
tags:
- Children
summary: the child catalogs and collections of the root catalog
description: |-
A body of Catalogs and Collections that are immediate children of this root Catalog.
operationId: getChildren
responses:
'200':
$ref: '#/components/responses/Children'
'500':
$ref: '#/components/responses/ServerError'
components:
schemas:
children:
type: object
required:
- links
- children
properties:
links:
$ref: '../core/commons.yaml#/components/schemas/links'
children:
type: array
items:
anyOf:
- $ref: '../core/commons.yaml#/components/schemas/catalog'
- $ref: '../core/commons.yaml#/components/schemas/collection'
responses:
Children:
description: |-
The child catalogs and collections of the root catalog this API represents.
content:
application/json:
schema:
$ref: '#/components/schemas/children'
InvalidParameter:
description: |-
A query parameter has an invalid value.
content:
application/json:
schema:
$ref: '../core/commons.yaml#/components/schemas/exception'
NotFound:
description: |-
The requested URI was not found.
ServerError:
description: |-
A server error occurred.
content:
application/json:
schema:
$ref: '../core/commons.yaml#/components/schemas/exception'
7 changes: 4 additions & 3 deletions collections/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@
- [Example](#example)

- **OpenAPI specification:** [openapi.yaml](openapi.yaml) ([rendered version](https://api.stacspec.org/v1.0.0-beta.5/collections))
- **Conformance URI:** <http://stacspec.org/spec/api/1.0.0-beta.5/extensions/collections>
- **Conformance URI:** <https://api.stacspec.org/v1.0.0-beta.5/collections>
- **Extension [Maturity Classification](../extensions.md#extension-maturity):** Pilot
- **Dependencies**: [STAC API - Core](../core)

A STAC API can return information about all STAC [Collections](../stac-spec/collection-spec/collection-spec.md) available using a link
from the landing page that uses the `data` rel, which links to an endpoint called `/collections`. Individual STAC collections can be accessed
from the landing page that uses the link relation `data`, which links to an endpoint called `/collections`.
Individual STAC collections can be accessed
by providing the Collection `id` as a path past that endpoint: `/collections/{collectionId}`.

**NOTE**: *This conformance class is directly based on the [Features Collection](http://docs.opengeospatial.org/is/17-069r3/17-069r3.html#_collections_)
section of OAFeat, which is in the process of becoming a 'building block in [OGC API - Common - Part 2: Geospatial
section of OAFeat, which is in the process of becoming a 'building block' in [OGC API - Common - Part 2: Geospatial
Data](http://docs.opengeospatial.org/DRAFTS/20-024.html) as the [Collections requirements
class](http://docs.opengeospatial.org/DRAFTS/20-024.html#rc_collections-section). Once the Common version is released we will
aim to align with it. But it still seems to be in flux.*
Expand Down
Loading