Skip to content

Commit

Permalink
Adds render cross reference in links
Browse files Browse the repository at this point in the history
This PR Adds render cross reference in links and fix #2
  • Loading branch information
emmanuelmathot committed Apr 17, 2024
1 parent 9b57094 commit edaeaed
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 16 deletions.
2 changes: 2 additions & 0 deletions 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

- Adds render cross reference in links ([#2](https://github.com/stac-extensions/render/issues/2))

### Changed

### Deprecated
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,22 @@ It is highly suggested to have a web map link in the `links` section of the STAC
[Web Map Link extension](https://github.com/stac-extensions/web-map-links) to allow application to
find the tiling endpoint of the dynamic tile server.

### Additional Attributes

A [web map link](https://github.com/stac-extensions/web-map-links) can be extended with the attribute `render`
with a value corresponding to the key of the render object in the `renders` field
in order to provide a cross link to the render object.

```json
{
"rel": "xyz",
"type": "image/png",
"title": "NDVI",
"href": "https://api.cogeo.xyz/stac/preview.png?url=https://raw.githubusercontent.com/stac-extensions/raster/main/examples/item-landsat8.json&expression=(B5–B4)/(B5+B4)&max_size=512&width=512&resampling_method=average&rescale=-1,1&color_map=ylgn&return_mask=true",
"render": "ndvi"
}
```

## Contributing

All contributions are subject to the
Expand Down
16 changes: 15 additions & 1 deletion examples/item-landsat8.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"https://stac-extensions.github.io/projection/v1.0.0/schema.json",
"https://stac-extensions.github.io/view/v1.0.0/schema.json",
"https://stac-extensions.github.io/render/v1.0.0/schema.json",
"https://stac-extensions.github.io/virtual-assets/v1.0.0/schema.json"
"https://stac-extensions.github.io/virtual-assets/v1.0.0/schema.json",
"https://stac-extensions.github.io/web-map-links/v1.2.0/schema.json"
],
"id": "LC08_L1TP_044033_20210305_20210312_01_T1",
"properties": {
Expand Down Expand Up @@ -66,6 +67,19 @@
"type": "image/png",
"title": "RGB composite visualized through a XYZ"
},
{
"rel": "xyz",
"type": "image/png",
"title": "NDVI",
"href": "https://api.cogeo.xyz/stac/preview.png?url=https://raw.githubusercontent.com/stac-extensions/raster/main/examples/item-landsat8.json&expression=(B5–B4)/(B5+B4)&max_size=512&width=512&resampling_method=average&rescale=-1,1&color_map=ylgn&return_mask=true",
"render": "ndvi"
},
{
"rel": "xyz",
"type": "image/png",
"title": "NDVI",
"href": "https://api.cogeo.xyz/stac/preview.png?url=https://raw.githubusercontent.com/stac-extensions/raster/main/examples/item-landsat8.json&expression=(B5–B4)/(B5+B4)&max_size=512&width=512&resampling_method=average&rescale=-1,1&color_map=ylgn&return_mask=true"
},
{
"rel": "collection",
"href": "https://landsat-stac.s3.amazonaws.com/collections/landsat-8-l1.json",
Expand Down
129 changes: 114 additions & 15 deletions json-schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,37 @@
}
}
}
},
{
"if": {
"properties": {
"stac_extensions": {
"contains": {
"type": "string",
"pattern": "https:\/\/stac-extensions\\.github\\.io\/web-map-links\/.*"
}
}
}
},
"then": {
"properties": {
"links": {
"type": "array",
"contains": {
"type": "object",
"required": [
"rel",
"render"
],
"properties": {
"render": {
"type": "string"
}
}
}
}
}
}
}
]
},
Expand All @@ -55,8 +86,18 @@
{
"$comment": "This validates the fields in Collection Assets, but does not require them.",
"anyOf": [
{"type": "object", "required": ["assets"]},
{"type": "object", "required": ["item_assets"]}
{
"type": "object",
"required": [
"assets"
]
},
{
"type": "object",
"required": [
"item_assets"
]
}
],
"properties": {
"renders": {
Expand Down Expand Up @@ -99,17 +140,72 @@
"require_any_field": {
"$comment": "Please list all fields here so that we can force the existence of one of them in other parts of the schemas.",
"anyOf": [
{"type": "object", "required": ["assets"]},
{"type": "object", "required": ["title"]},
{"type": "object", "required": ["rescale"]},
{"type": "object", "required": ["nodata"]},
{"type": "object", "required": ["colormap_name"]},
{"type": "object", "required": ["colormap"]},
{"type": "object", "required": ["color_formula"]},
{"type": "object", "required": ["resampling"]},
{"type": "object", "required": ["expression"]},
{"type": "object", "required": ["minmax_zoom"]},
{"type": "object", "required": ["bidx"]}
{
"type": "object",
"required": [
"assets"
]
},
{
"type": "object",
"required": [
"title"
]
},
{
"type": "object",
"required": [
"rescale"
]
},
{
"type": "object",
"required": [
"nodata"
]
},
{
"type": "object",
"required": [
"colormap_name"
]
},
{
"type": "object",
"required": [
"colormap"
]
},
{
"type": "object",
"required": [
"color_formula"
]
},
{
"type": "object",
"required": [
"resampling"
]
},
{
"type": "object",
"required": [
"expression"
]
},
{
"type": "object",
"required": [
"minmax_zoom"
]
},
{
"type": "object",
"required": [
"bidx"
]
}
]
},
"fields": {
Expand Down Expand Up @@ -138,7 +234,10 @@
}
},
"nodata": {
"type": ["number","string"]
"type": [
"number",
"string"
]
},
"colormap_name": {
"type": "string"
Expand All @@ -161,7 +260,7 @@
"type": "number"
}
},
"bidx":{
"bidx": {
"type": "array",
"items": {
"type": "number"
Expand Down

0 comments on commit edaeaed

Please sign in to comment.