diff --git a/CHANGELOG.md b/CHANGELOG.md index 86101e8..c5f8a2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,4 +16,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Place 'renders' object in Item properties [#4](https://github.com/stac-extensions/render/issues/4) + [Unreleased]: diff --git a/README.md b/README.md index bf52f0b..b53542a 100644 --- a/README.md +++ b/README.md @@ -120,13 +120,15 @@ by simply specifying the `url` and `assets` query parameters. From the [Sentinel-2 item](https://github.com/stac-extensions/virtual-assets/blob/main/examples/item-sentinel2.json): ```json -"renders":{ - "sir": - { - "title": "Shortwave Infra-red", - "assets": [ "swir22", "nir2", "red" ], - "rescale": [[0,5000],[0,7000],[0,9000]], - "resampling": "nearest" +"properties":{ + "renders":{ + "sir": + { + "title": "Shortwave Infra-red", + "assets": [ "swir22", "nir2", "red" ], + "rescale": [[0,5000],[0,7000],[0,9000]], + "resampling": "nearest" + } } } ``` @@ -167,15 +169,18 @@ the NDVI asset could also be downloaded as a standalone asset. }, } }, -"renders":{ - "ndvi": - { - "title": "Normalized Difference Vegetation Index", - "assets": [ "ndvi" ], - "resampling": "average", - "colormap_name": "ylgn" +"properties":{ + "renders":{ + "ndvi": + { + "title": "Normalized Difference Vegetation Index", + "assets": [ "ndvi" ], + "resampling": "average", + "colormap_name": "ylgn" + } } } + ``` If this case, the parameters to titiler must be extracted from both the virtual asset definition and the render object. @@ -199,15 +204,17 @@ Result: Landsat Surface Reflectance Normalized Difference Vegetation Index (NDV Obviously, the same rendering can be applied to local source assets without using the virtual asset. ```json -"renders":{ - "ndvi": - { - "title": "Normalized Difference Vegetation Index", - "assets": [ "B05", "B04" ], - "resampling": "average", - "colormap_name": "ylgn", - "expression": "(B05–B04)/(B05+B04)", - "rescale": [[-1,1]] +"properties":{ + "renders":{ + "ndvi": + { + "title": "Normalized Difference Vegetation Index", + "assets": [ "B05", "B04" ], + "resampling": "average", + "colormap_name": "ylgn", + "expression": "(B05–B04)/(B05+B04)", + "rescale": [[-1,1]] + } } } ``` diff --git a/examples/item-landsat8.json b/examples/item-landsat8.json index a64774d..1f6d9dd 100644 --- a/examples/item-landsat8.json +++ b/examples/item-landsat8.json @@ -30,7 +30,43 @@ "landsat:wrs_row": "33", "datetime": "2021-03-05T18:45:37.619485Z", "created": "2021-03-16T01:40:56.703Z", - "updated": "2021-03-16T01:40:56.703Z" + "updated": "2021-03-16T01:40:56.703Z", + "renders": { + "thumbnail": { + "title": "Thumbnail", + "assets": [ + "B4", + "B3", + "B2" + ], + "rescale": [ + [ + 0, + 150 + ] + ], + "colormap_name": "rainbow", + "resampling": "bilinear", + "bidx": [ + 1 + ], + "width": 1024, + "height": 1024, + "bands": [ + "B4", + "B3", + "B2" + ] + }, + "ndvi": { + "title": "Normalized Difference Vegetation Index", + "assets": [ + "ndvi" + ], + "resampling": "average", + "colormap_name": "ylgn" + } + } }, "geometry": { "type": "Polygon", @@ -269,42 +305,6 @@ } } }, - "renders": { - "thumbnail": { - "title": "Thumbnail", - "assets": [ - "B4", - "B3", - "B2" - ], - "rescale": [ - [ - 0, - 150 - ] - ], - "colormap_name": "rainbow", - "resampling": "bilinear", - "bidx": [ - 1 - ], - "width": 1024, - "height": 1024, - "bands": [ - "B4", - "B3", - "B2" - ] - }, - "ndvi": { - "title": "Normalized Difference Vegetation Index", - "assets": [ - "ndvi" - ], - "resampling": "average", - "colormap_name": "ylgn" - } - }, "bbox": [ -123.00234, 37.82405, diff --git a/examples/item-sentinel2.json b/examples/item-sentinel2.json index 265addf..787dd88 100644 --- a/examples/item-sentinel2.json +++ b/examples/item-sentinel2.json @@ -60,7 +60,32 @@ "sentinel:product_id": "S2B_MSIL2A_20210221T095029_N0214_R079_T33SVB_20210221T115149", "sentinel:data_coverage": 100, "eo:cloud_cover": 21.22, - "sentinel:valid_cloud_cover": true + "sentinel:valid_cloud_cover": true, + "renders": { + "sir": { + "title": "Shortwave Infra-red", + "assets": [ + "swir22", + "nir2", + "red" + ], + "rescale": [ + [ + 0, + 5000 + ], + [ + 0, + 7000 + ], + [ + 0, + 9000 + ] + ], + "resampling": "nearest" + } + } }, "collection": "sentinel-s2-l2a-cogs", "assets": { @@ -617,31 +642,6 @@ ] } }, - "renders": { - "sir": { - "title": "Shortwave Infra-red", - "assets": [ - "swir22", - "nir2", - "red" - ], - "rescale": [ - [ - 0, - 5000 - ], - [ - 0, - 7000 - ], - [ - 0, - 9000 - ] - ], - "resampling": "nearest" - } - }, "links": [ { "rel": "collection", diff --git a/json-schema/schema.json b/json-schema/schema.json index 20e0cab..22231ff 100644 --- a/json-schema/schema.json +++ b/json-schema/schema.json @@ -5,7 +5,7 @@ "description": "STAC Rendering Extension for STAC Items and STAC Collections.", "oneOf": [ { - "$comment": "This is the schema for STAC Items. Remove this object if this extension only applies to Collections.", + "$comment": "This is the schema for STAC Items.", "allOf": [ { "$ref": "#/definitions/stac_extensions" @@ -14,18 +14,23 @@ "type": "object", "required": [ "type", - "assets", - "renders" + "properties", + "assets" ], "properties": { "type": { "const": "Feature" }, - "renders": { - "$comment": "This validates the fields in Item Assets, but does not require them.", + "properties": { "type": "object", - "additionalProperties": { - "$ref": "#/definitions/fields" + "required": ["renders"], + "properties": { + "renders": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/fields" + } + } } } } @@ -161,7 +166,7 @@ "type": "number" } }, - "bidx":{ + "bidx": { "type": "array", "items": { "type": "number"