Skip to content

Commit

Permalink
Add attribution extension
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Jul 24, 2024
1 parent c88a91c commit f35cde2
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 273 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

[Unreleased]: <https://github.com/stac-extensions/template/compare/v1.0.0...HEAD>
## [v0.1.0]

- Initial release

[Unreleased]: <https://github.com/stac-extensions/attribution/compare/v0.1.0...HEAD>
[v0.1.0]: <https://github.com/stac-extensions/authentication/tree/v0.1.0>
33 changes: 33 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Contributing

All contributions are subject to the
[STAC Specification Code of Conduct](https://github.com/radiantearth/stac-spec/blob/master/CODE_OF_CONDUCT.md).
For contributions, please follow the
[STAC specification contributing guide](https://github.com/radiantearth/stac-spec/blob/master/CONTRIBUTING.md) Instructions
for running tests are copied here for convenience.

## Running tests

The same checks that run as checks on PR's are part of the repository and can be run locally to verify that changes are valid.
To run tests locally, you'll need `npm`, which is a standard part of any [node.js installation](https://nodejs.org/en/download/).

First you'll need to install everything with npm once. Just navigate to the root of this repository and on
your command line run:

```bash
npm install
```

Then to check markdown formatting and test the examples against the JSON schema, you can run:

```bash
npm test
```

This will spit out the same texts that you see online, and you can then go and fix your markdown or examples.

If the tests reveal formatting problems with the examples, you can fix them with:

```bash
npm run format-examples
```
86 changes: 22 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# Template Extension Specification
# Attribution Extension Specification

- **Title:** Template
- **Identifier:** <https://stac-extensions.github.io/template/v1.0.0/schema.json>
- **Field Name Prefix:** template
- **Title:** Attribution
- **Identifier:** <https://stac-extensions.github.io/attribution/v0.1.0/schema.json>
- **Field Name Prefix:** -
- **Scope:** Item, Collection
- **Extension [Maturity Classification](https://github.com/radiantearth/stac-spec/tree/master/extensions/README.md#extension-maturity):** Proposal
- **Owner**: @your-gh-handles @person2
- **Owner**: @m-mohr

This document explains the Template Extension to the [SpatioTemporal Asset Catalog](https://github.com/radiantearth/stac-spec) (STAC) specification.
This is the place to add a short introduction.
This document explains the Attribution Extension to the
[SpatioTemporal Asset Catalog](https://github.com/radiantearth/stac-spec) (STAC) specification.
Allows to provide an attribution, which is compliant with OGC API Collections.
This is commonly seen in web maps to give credit to e.g. the basemap provider.

- Examples:
- [Item example](examples/item.json): Shows the basic usage of the extension in a STAC Item
Expand All @@ -20,70 +22,26 @@ This is the place to add a short introduction.

The fields in the table below can be used in these parts of STAC documents:

- [ ] Catalogs
- [x] Catalogs
- [x] Collections
- [x] Item Properties (incl. Summaries in Collections)
- [x] Assets (for both Collections and Items, incl. Item Asset Definitions in Collections)
- [ ] Links

| Field Name | Type | Description |
| -------------------- | ------------------------- | -------------------------------------------- |
| template:new_field | string | **REQUIRED**. Describe the required field... |
| template:xyz | [XYZ Object](#xyz-object) | Describe the field... |
| template:another_one | \[number] | Describe the field... |
| Field Name | Type | Description |
| ----------- | ------ | -------------------------------------------- |
| attribution | string | **REQUIRED**. A short test intended for presentation to a user, for example, in a corner of a map. |

### Additional Field Information
The attribution is a short text intended for presentation to a user, for example, in a corner of a map.
Parts of the text can be links to other resources if additional information is needed.

#### template:new_field

This is a much more detailed description of the field `template:new_field`...

### XYZ Object

This is the introduction for the purpose and the content of the XYZ Object...

| Field Name | Type | Description |
| ---------- | ------ | -------------------------------------------- |
| x | number | **REQUIRED**. Describe the required field... |
| y | number | **REQUIRED**. Describe the required field... |
| z | number | **REQUIRED**. Describe the required field... |

## Relation types

The following types should be used as applicable `rel` types in the
[Link Object](https://github.com/radiantearth/stac-spec/tree/master/item-spec/item-spec.md#link-object).

| Type | Description |
| -------------- | ------------------------------------- |
| fancy-rel-type | This link points to a fancy resource. |
The attribution element can contain HTML markup.
It allows a text string to import images and format text.
The capabilities are only limited by the markup language used.
It is RECOMMENDED to keep the attributions simple so that clients can render them properly,
ideally just plain text and potentially a link that points to additional information.
Additionally, clients may decide to restrict the HTML capabilities for security reasons.

## Contributing

All contributions are subject to the
[STAC Specification Code of Conduct](https://github.com/radiantearth/stac-spec/blob/master/CODE_OF_CONDUCT.md).
For contributions, please follow the
[STAC specification contributing guide](https://github.com/radiantearth/stac-spec/blob/master/CONTRIBUTING.md) Instructions
for running tests are copied here for convenience.

### Running tests

The same checks that run as checks on PR's are part of the repository and can be run locally to verify that changes are valid.
To run tests locally, you'll need `npm`, which is a standard part of any [node.js installation](https://nodejs.org/en/download/).

First you'll need to install everything with npm once. Just navigate to the root of this repository and on
your command line run:
```bash
npm install
```

Then to check markdown formatting and test the examples against the JSON schema, you can run:
```bash
npm test
```

This will spit out the same texts that you see online, and you can then go and fix your markdown or examples.

If the tests reveal formatting problems with the examples, you can fix them with:
```bash
npm run format-examples
```
See the [Contributor documentation](CONTRIBUTING.md) for details.
35 changes: 2 additions & 33 deletions examples/collection.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"stac_version": "1.0.0",
"stac_extensions": [
"https://stac-extensions.github.io/item-assets/v1.0.0/schema.json",
"https://stac-extensions.github.io/template/v1.0.0/schema.json"
"https://stac-extensions.github.io/attribution/v0.1.0/schema.json"
],
"type": "Collection",
"id": "collection",
"title": "A title",
"description": "A description",
"license": "Apache-2.0",
"attribution": "Provided by <a href='https://example.com' target='_blank'>Example Corporation</a>",
"extent": {
"spatial": {
"bbox": [
Expand All @@ -29,37 +29,6 @@
]
}
},
"template:new_field": "test",
"template:xyz": {
"x": 1,
"y": 2,
"z": 3
},
"template:another_one": [
1,
2,
3
],
"assets": {
"example": {
"href": "https://example.com/examples/file.xyz",
"template:new_field": "test"
}
},
"item_assets": {
"data": {
"roles": [
"data"
],
"template:new_field": "test"
}
},
"summaries": {
"datetime": {
"minimum": "2015-06-23T00:00:00Z",
"maximum": "2019-07-10T13:44:56Z"
}
},
"links": [
{
"href": "https://example.com/examples/collection.json",
Expand Down
26 changes: 11 additions & 15 deletions examples/item.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"stac_version": "1.0.0",
"stac_extensions": [
"https://stac-extensions.github.io/template/v1.0.0/schema.json"
"https://stac-extensions.github.io/attribution/v0.1.0/schema.json"
],
"type": "Feature",
"id": "item",
Expand Down Expand Up @@ -40,17 +40,7 @@
},
"properties": {
"datetime": "2020-12-11T22:38:32Z",
"template:new_field": "test",
"template:xyz": {
"x": 1,
"y": 2,
"z": 3
},
"template:another_one": [
1,
2,
3
]
"attribution": "Provided by <a href='https://example.com' target='_blank'>Example Corporation</a>"
},
"links": [
{
Expand All @@ -60,8 +50,14 @@
],
"assets": {
"data": {
"href": "https://example.com/examples/file.xyz",
"template:new_field": "test"
"href": "https://example.com/examples/file.xyz"
},
"data2": {
"href": "https://example.com/examples/file.xyz"
},
"data_other_provider": {
"href": "https://other-provider.com/examples/file.xyz",
"attribution": "&copy; <a href='https://other-provider.com' target='_blank'>Other Provider, Inc.</a>"
}
}
}
}
Loading

0 comments on commit f35cde2

Please sign in to comment.