From edaeaedf7aa5f8ec5e34c0e1b04009d2aad0863f Mon Sep 17 00:00:00 2001 From: Emmanuel Mathot Date: Wed, 17 Apr 2024 11:38:16 +0200 Subject: [PATCH] Adds render cross reference in links This PR Adds render cross reference in links and fix #2 --- CHANGELOG.md | 2 + README.md | 16 +++++ examples/item-landsat8.json | 16 ++++- json-schema/schema.json | 129 +++++++++++++++++++++++++++++++----- 4 files changed, 147 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86101e8..eb31dc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index bf52f0b..ded6307 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/examples/item-landsat8.json b/examples/item-landsat8.json index a64774d..94574d6 100644 --- a/examples/item-landsat8.json +++ b/examples/item-landsat8.json @@ -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": { @@ -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", diff --git a/json-schema/schema.json b/json-schema/schema.json index 20e0cab..5605b2e 100644 --- a/json-schema/schema.json +++ b/json-schema/schema.json @@ -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" + } + } + } + } + } + } } ] }, @@ -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": { @@ -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": { @@ -138,7 +234,10 @@ } }, "nodata": { - "type": ["number","string"] + "type": [ + "number", + "string" + ] }, "colormap_name": { "type": "string" @@ -161,7 +260,7 @@ "type": "number" } }, - "bidx":{ + "bidx": { "type": "array", "items": { "type": "number"