Skip to content

Commit 5076180

Browse files
authored
Refactor common parts of the spec #1203 (#1304)
* Refactor common parts of the spec #1203 * Added more docs for commons
1 parent 590e392 commit 5076180

14 files changed

+839
-821
lines changed

CHANGELOG.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
3333
- All JSON Schema `$id` values no longer have `#` at the end.
3434
- Two spatial bounding boxes in a Collection don't make sense and will be reported as invalid by the schema. ([#1243](https://github.com/radiantearth/stac-spec/issues/1243))
3535
- Clarify in descriptions that start_datetime and end_datetime are inclusive bounds ([#1280](https://github.com/radiantearth/stac-spec/issues/1280))
36-
- Moved the STAC structural relations in common metadata spec
36+
- Moved the STAC structural relations into commons
37+
- Moved general descriptions about Assets and Links into commons
38+
- Moved common metadata from the item-spec into commons, but kept the JSON schemas in the item-spec for backward compatibility
3739

3840
### Deprecated
3941

@@ -218,7 +220,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
218220
### Added
219221
- ItemCollection requires `stac_version` field, `stac_extensions` has also been added
220222
- A `description` field has been added to Item assets (also Asset definitions extension)
221-
- Field `mission` to [Common Metadata fields](item-spec/common-metadata.md)
223+
- Field `mission` to [Common Metadata fields](commons/common-metadata.md)
222224
- Extensions:
223225
- [Version Indicators extension](https://github.com/stac-extensions/version/blob/main/README.md), new `version` and `deprecated` fields in STAC Items and Collections
224226
- Data Cube extension can be used in Collections, added new field `description`
@@ -228,7 +230,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
228230
- STAC API:
229231
- Added the [Item and Collection API Version extension](https://github.com/radiantearth/stac-api-spec/tree/master/extensions/version/README.md) to support versioning in the API specification
230232
- Run `npm run serve` or `npm run serve-ext` to quickly render development versions of the OpenAPI spec in the browser
231-
- [Basics](item-spec/common-metadata.md#basics) added to Common Metadata definitions with new `description` field for
233+
- [Basics](commons/common-metadata.md#basics) added to Common Metadata definitions with new `description` field for
232234
Item properties
233235
- New fields to the `link` object to facilitate [pagination support for POST requests](https://github.com/radiantearth/stac-api-spec/tree/master/api-spec.md#paging-extension)
234236
- `data` role, as a suggestion for a common role for data files to be used in case data providers don't come up with their own names and semantics
@@ -240,7 +242,7 @@ Item properties
240242
- Added field `roles` to Item assets (also Asset definitions extension), to be used similarly to Link `rel`
241243
- Updated API yaml to clarify bbox filter should be implemented without brackets. Example: `bbox=160.6,-55.95,-170,-25.89`
242244
- Collection `summaries` merge array fields now
243-
- Several fields have been moved from extensions or item fields to the [Common Metadata fields](item-spec/common-metadata.md):
245+
- Several fields have been moved from extensions or item fields to the [Common Metadata fields](commons/common-metadata.md):
244246
- `eo:platform` / `sar:platform` => `platform`
245247
- `eo:instrument` / `sar:instrument` => `instruments`, also changed from string to array of strings
246248
- `eo:constellation` / `sar:constellation` => `constellation`
@@ -264,7 +266,7 @@ Item properties
264266
- `search` extension renamed to `context` extension. JSON object renamed from `search:metadata` to `context`
265267
- Removed "next" from the search metadata and query parameter, added POST body and headers to the links for paging support
266268
- Query Extension - type restrictions on query predicates are more accurate, which may require additional implementation support
267-
- Item `title` definition moved from core Item fields to [Common Metadata Basics](item-spec/common-metadata.md#basics)
269+
- Item `title` definition moved from core Item fields to [Common Metadata Basics](commons/common-metadata.md#basics)
268270
fields. No change is required for STAC Items.
269271
- `putFeature` can return a `PreconditionFailed` to provide more explicit information when the resource has changed in the server
270272
- [Sort extension](https://github.com/radiantearth/stac-api-spec/tree/master/extensions/sort) now uses "+" and "-" prefixes for GET requests to denote sort order.
@@ -281,7 +283,7 @@ fields. No change is required for STAC Items.
281283
- `gsd` and `accuracy` from `eo:bands` in the [EO extension](https://github.com/stac-extensions/eo/blob/main/README.md)
282284
- `sar:absolute_orbit` and `sar:center_wavelength` fields from the [SAR extension](https://github.com/stac-extensions/sar/blob/main/README.md)
283285
- `data_type` and `unit` from the `sar:bands` object in the [SAR extension](https://github.com/stac-extensions/sar/blob/main/README.md)
284-
- Datetime Range (`dtr`) extension. Use the [Common Metadata fields](item-spec/common-metadata.md) instead
286+
- Datetime Range (`dtr`) extension. Use the [Common Metadata fields](commons/common-metadata.md) instead
285287
- STAC API:
286288
- `next` from the search metadata and query parameter
287289
- In API, removed any mention of using media type `multipart/form-data` and `x-www-form-urlencoded`

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ used together, but are designed so each piece is small, self-contained, and reus
8989
In the context of STAC it is most likely a related group of STAC Items that is made available by a data provider.
9090
It includes things like the spatial and temporal extent of the data, the license, keywords, etc.
9191
It enables discovery at a higher level than individual Item objects, providing a simple way to describe sets of data.
92+
- **[Commons](commons/)** describes parts of the specification that are shared across the specifications listed above.
93+
This includes [assets](commons/assets.md), [links](commons/links.md)
94+
and [common metadata](commons/common-metadata.md).
9295
- **[Examples](examples/):** The *[examples/](examples/)* folder contains examples for all three specifications, linked together to form two
9396
complete examples. Each spec and extension links in to highlight particular files that demonstrate key concepts.
9497
- **[Extensions](extensions/README.md)** describe how STAC can use extensions that extend the functionality of the core spec or

best-practices.md

+14-13
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ instead of thinking through all the ways providers might have chosen to name it.
195195
In general STAC aims to be oriented around **search**, centered on the core fields that users will want to search on to find
196196
imagery. The core is space and time, but there are often other metadata fields that are useful. While the specification is
197197
flexible enough that providers can fill it with tens or even hundreds of fields of metadata, that is not recommended. If
198-
providers have lots of metadata then that can be linked to in the [Asset Object](item-spec/item-spec.md#asset-object)
199-
(recommended) or in a [Link Object](item-spec/item-spec.md#link-object). There is a lot of metadata that is only of relevance
198+
providers have lots of metadata then that can be linked to in the [Asset Object](commons/assets.md#asset-object)
199+
(recommended) or in a [Link Object](commons/links.md#link-object). There is a lot of metadata that is only of relevance
200200
to loading and processing data, and while STAC does not prohibit providers from putting those type of fields in their items,
201201
it is not recommended. For very large catalogs (hundreds of millions of records),
202202
every additional field that is indexed will cost substantial money, so data providers are advised to just put the fields to be searched in STAC and
@@ -209,7 +209,7 @@ STAC. And it can also be one of the most confusing, especially for data that cov
209209
is straightforward - it is the capture or acquisition time. But often data is processed from a range of captures - drones usually
210210
gather a set of images over an hour and put them into a single image, mosaics combine data from several months, and data cubes
211211
represent slices of data over a range of time. For all these cases the recommended path is to use `start_datetime` and
212-
`end_datetime` fields from [common metadata](item-spec/common-metadata.md#date-and-time-range). The specification does allow one to set the
212+
`end_datetime` fields from [common metadata](commons/common-metadata.md#date-and-time-range). The specification does allow one to set the
213213
`datetime` field to `null`, but it is strongly recommended to populate the single `datetime` field, as that is what many clients
214214
will search on. If it is at all possible to pick a nominal or representative datetime then that should be used. But sometimes that
215215
is not possible, like a data cube that covers a time range from 1900 to 2000. Setting the datetime as 1950 would lead to it not
@@ -258,7 +258,7 @@ not spatial. This use case is not currently supported by STAC, as we are focused
258258
in nature. The [OGC API - Records](https://github.com/opengeospatial/ogcapi-records) is an emerging standard that likely
259259
will be able to handle a wider range of data than STAC. It builds on [OGC API -
260260
Features](https://github.com/opengeospatial/ogcapi-features) just like [STAC API](https://github.com/radiantearth/stac-api-spec/)
261-
does. Using [Collection Assets](collection-spec/collection-spec.md#asset-object) may also provide an option for some
261+
does. Using [Collection Assets](collection-spec/collection-spec.md#assets) may also provide an option for some
262262
use cases.
263263

264264
### Representing Vector Layers in STAC
@@ -277,14 +277,14 @@ Both are compliant with OGC API - Features, adding richer search capabilities to
277277

278278
### Common Use Cases of Additional Fields for Assets
279279

280-
As [described in the Item spec](item-spec/item-spec.md#additional-fields-for-assets), it is possible to use fields typically
280+
As [described in the Item spec](commons/assets.md#additional-fields), it is possible to use fields typically
281281
found in Item properties at the asset level. This mechanism of overriding or providing Item Properties only in the Assets
282282
makes discovery more difficult and should generally be avoided. However, there are some core and extension fields for which
283283
providing them at the Asset level can prove to be very useful for using the data.
284284

285285
- `datetime`: Provide individual timestamp on an Item, in case the Item has a `start_datetime` and `end_datetime`,
286286
but an Asset is for one specific time.
287-
- `gsd` ([Common Metadata](item-spec/common-metadata.md#instrument)): Specify some assets that represent instruments
287+
- `gsd` ([Common Metadata](commons/common-metadata.md#instrument)): Specify some assets that represent instruments
288288
with different spatial resolution than the overall best resolution. Note this should not be used for different
289289
spatial resolutions due to specific processing of assets - look into the [raster
290290
extension](https://github.com/stac-extensions/raster) for that use case.
@@ -368,7 +368,7 @@ it. It is relatively easy to [register](https://www.iana.org/form/media-types) a
368368

369369
### Asset Roles
370370

371-
[Asset roles](item-spec/item-spec.md#asset-roles) are used to describe what each asset is used for. They are particular useful
371+
[Asset roles](commons/assets.md#roles) are used to describe what each asset is used for. They are particular useful
372372
when several assets have the same media type, such as when an Item has a multispectral analytic asset, a 3-band full resolution
373373
visual asset, a down-sampled preview asset, and a cloud mask asset, all stored as Cloud Optimized GeoTIFF (COG) images. It is
374374
recommended to use at least one role for every asset available, and using multiple roles often makes sense. For example you'd use
@@ -783,25 +783,25 @@ while a value of 15 to 40 would tell them that it's oblique imagery, or 0 to 60
783783
a Collection with lots of different look angles.
784784

785785
- Fields that have only one or a handful of values are also great to summarize. Collections with a single satellite may
786-
use a single [`gsd`](item-spec/common-metadata.md#instrument) field in the summary, and it's quite useful for users to know
786+
use a single [`gsd`](commons/common-metadata.md#instrument) field in the summary, and it's quite useful for users to know
787787
that all data is going to be the same resolution. Similarly it's useful to know the names of all the
788-
[`platform` values](item-spec/common-metadata.md#instrument) that are used in the Collection.
788+
[`platform` values](commons/common-metadata.md#instrument) that are used in the Collection.
789789

790790
- It is less useful to summarize fields that have numerous different discrete values that can't easily be represented
791791
in a range. These will mostly be string values, when there aren't just a handful of options. For example if you had a
792792
'location' field that gave 3 levels of administrative region (like 'San Francisco, California, United States') to help people
793793
understand more intuitively where a shot was taken. If your Collection has millions of Items, or even hundreds, you don't want
794794
to include all the different location string values in a summary.
795795

796-
- Fields that consist of arrays are more of a judgement call. For example [`instruments`](item-spec/common-metadata.md#instrument)
796+
- Fields that consist of arrays are more of a judgement call. For example [`instruments`](commons/common-metadata.md#instrument)
797797
is straightforward and recommended, as the elements of the array are a discrete set of options. On the other hand
798798
[`proj:transform`](https://github.com/stac-extensions/projection/blob/main/README.md#projtransform)
799799
makes no sense to summarize, as the union of all the values
800800
in the array are meaningless, as each Item is describing its transform, so combining them would just be a bunch of random numbers.
801801
So if the values contained in the array are independently meaningful (not interconnected) and there aren't hundreds of potential
802802
values then it is likely a good candidate to summarize.
803803

804-
We do highly recommend including a [`bands`](./item-spec/common-metadata.md#bands)
804+
We do highly recommend including a [`bands`](./commons/common-metadata.md#bands)
805805
summary if your Items implement `bands`,
806806
especially if it represents just one satellite or constellation. This should be a union of all the potential bands that you
807807
have in assets. It is ok to only add the summary at the Collection level without putting `bands` at the
@@ -1009,8 +1009,9 @@ When crawling a STAC implementation, one can also make use of the [relation type
10091009
) (`rel` field) when following a link. If it is an `item` rel type then the file must be a STAC Item. If it is `child`, `parent` or
10101010
`root` then it must be a Catalog or a Collection, though the final determination between the two requires looking at the `type` field
10111011
in the Catalog or Collection JSON that it is linked to. Note that there is also a `type` field in STAC Link and Asset objects, but that
1012-
is for the Media Type, but there are not specific media types for Catalog and Collection. See the sections on [STAC media
1013-
types](catalog-spec/catalog-spec.md#media-types), and [Asset media types](item-spec/item-spec.md#asset-media-type) for more information.
1012+
is for the Media Type, but there are not specific media types for Catalog and Collection.
1013+
See the sections on [STAC media types](commons/links.md#stac-media-types),
1014+
and [Asset media types](commons/assets.md#media-types) for more information.
10141015
10151016
In versions of STAC prior to 1.0 the process was a bit more complicated, as there was no `type` field for catalogs and collections.
10161017
See [this issue comment](https://github.com/radiantearth/stac-spec/issues/889#issuecomment-684529444) for a heuristic that works

catalog-spec/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ It includes in depth explanation of the structures and fields.
3434
**Schemas:** The schemas to validate the core Catalog definition are found in the *[json-schema/](json-schema/)* folder.
3535
The primary one is *[catalog.json](json-schema/catalog.json)*.
3636

37-
## Catalog Evolution
37+
## Catalog Evolution
3838

3939
The Catalog specification is maturing, but it is still relatively early days. The core of Catalog has been defined very
4040
narrowly, to just describe a structure that can be followed by people or machines, so most additional functionality will

0 commit comments

Comments
 (0)