Skip to content

Commit

Permalink
Place 'renders' object in Item properties
Browse files Browse the repository at this point in the history
  • Loading branch information
giorgiobasile committed Apr 17, 2024
1 parent 9b57094 commit e5f9ee6
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 94 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]: <https://github.com/stac-extensions/render/compare/v1.0.0...HEAD>
53 changes: 30 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
```
Expand Down Expand Up @@ -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.
Expand All @@ -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]]
}
}
}
```
Expand Down
74 changes: 37 additions & 37 deletions examples/item-landsat8.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down
52 changes: 26 additions & 26 deletions examples/item-sentinel2.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down
21 changes: 13 additions & 8 deletions json-schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
}
}
}
}
}
Expand Down Expand Up @@ -161,7 +166,7 @@
"type": "number"
}
},
"bidx":{
"bidx": {
"type": "array",
"items": {
"type": "number"
Expand Down

0 comments on commit e5f9ee6

Please sign in to comment.