Skip to content

Commit e5f9ee6

Browse files
committed
Place 'renders' object in Item properties
1 parent 9b57094 commit e5f9ee6

File tree

5 files changed

+108
-94
lines changed

5 files changed

+108
-94
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616

1717
### Fixed
1818

19+
- Place 'renders' object in Item properties [#4](https://github.com/stac-extensions/render/issues/4)
20+
1921
[Unreleased]: <https://github.com/stac-extensions/render/compare/v1.0.0...HEAD>

README.md

+30-23
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,15 @@ by simply specifying the `url` and `assets` query parameters.
120120
From the [Sentinel-2 item](https://github.com/stac-extensions/virtual-assets/blob/main/examples/item-sentinel2.json):
121121

122122
```json
123-
"renders":{
124-
"sir":
125-
{
126-
"title": "Shortwave Infra-red",
127-
"assets": [ "swir22", "nir2", "red" ],
128-
"rescale": [[0,5000],[0,7000],[0,9000]],
129-
"resampling": "nearest"
123+
"properties":{
124+
"renders":{
125+
"sir":
126+
{
127+
"title": "Shortwave Infra-red",
128+
"assets": [ "swir22", "nir2", "red" ],
129+
"rescale": [[0,5000],[0,7000],[0,9000]],
130+
"resampling": "nearest"
131+
}
130132
}
131133
}
132134
```
@@ -167,15 +169,18 @@ the NDVI asset could also be downloaded as a standalone asset.
167169
},
168170
}
169171
},
170-
"renders":{
171-
"ndvi":
172-
{
173-
"title": "Normalized Difference Vegetation Index",
174-
"assets": [ "ndvi" ],
175-
"resampling": "average",
176-
"colormap_name": "ylgn"
172+
"properties":{
173+
"renders":{
174+
"ndvi":
175+
{
176+
"title": "Normalized Difference Vegetation Index",
177+
"assets": [ "ndvi" ],
178+
"resampling": "average",
179+
"colormap_name": "ylgn"
180+
}
177181
}
178182
}
183+
179184
```
180185

181186
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
199204
Obviously, the same rendering can be applied to local source assets without using the virtual asset.
200205

201206
```json
202-
"renders":{
203-
"ndvi":
204-
{
205-
"title": "Normalized Difference Vegetation Index",
206-
"assets": [ "B05", "B04" ],
207-
"resampling": "average",
208-
"colormap_name": "ylgn",
209-
"expression": "(B05–B04)/(B05+B04)",
210-
"rescale": [[-1,1]]
207+
"properties":{
208+
"renders":{
209+
"ndvi":
210+
{
211+
"title": "Normalized Difference Vegetation Index",
212+
"assets": [ "B05", "B04" ],
213+
"resampling": "average",
214+
"colormap_name": "ylgn",
215+
"expression": "(B05–B04)/(B05+B04)",
216+
"rescale": [[-1,1]]
217+
}
211218
}
212219
}
213220
```

examples/item-landsat8.json

+37-37
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,43 @@
3030
"landsat:wrs_row": "33",
3131
"datetime": "2021-03-05T18:45:37.619485Z",
3232
"created": "2021-03-16T01:40:56.703Z",
33-
"updated": "2021-03-16T01:40:56.703Z"
33+
"updated": "2021-03-16T01:40:56.703Z",
34+
"renders": {
35+
"thumbnail": {
36+
"title": "Thumbnail",
37+
"assets": [
38+
"B4",
39+
"B3",
40+
"B2"
41+
],
42+
"rescale": [
43+
[
44+
0,
45+
150
46+
]
47+
],
48+
"colormap_name": "rainbow",
49+
"resampling": "bilinear",
50+
"bidx": [
51+
1
52+
],
53+
"width": 1024,
54+
"height": 1024,
55+
"bands": [
56+
"B4",
57+
"B3",
58+
"B2"
59+
]
60+
},
61+
"ndvi": {
62+
"title": "Normalized Difference Vegetation Index",
63+
"assets": [
64+
"ndvi"
65+
],
66+
"resampling": "average",
67+
"colormap_name": "ylgn"
68+
}
69+
}
3470
},
3571
"geometry": {
3672
"type": "Polygon",
@@ -269,42 +305,6 @@
269305
}
270306
}
271307
},
272-
"renders": {
273-
"thumbnail": {
274-
"title": "Thumbnail",
275-
"assets": [
276-
"B4",
277-
"B3",
278-
"B2"
279-
],
280-
"rescale": [
281-
[
282-
0,
283-
150
284-
]
285-
],
286-
"colormap_name": "rainbow",
287-
"resampling": "bilinear",
288-
"bidx": [
289-
1
290-
],
291-
"width": 1024,
292-
"height": 1024,
293-
"bands": [
294-
"B4",
295-
"B3",
296-
"B2"
297-
]
298-
},
299-
"ndvi": {
300-
"title": "Normalized Difference Vegetation Index",
301-
"assets": [
302-
"ndvi"
303-
],
304-
"resampling": "average",
305-
"colormap_name": "ylgn"
306-
}
307-
},
308308
"bbox": [
309309
-123.00234,
310310
37.82405,

examples/item-sentinel2.json

+26-26
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,32 @@
6060
"sentinel:product_id": "S2B_MSIL2A_20210221T095029_N0214_R079_T33SVB_20210221T115149",
6161
"sentinel:data_coverage": 100,
6262
"eo:cloud_cover": 21.22,
63-
"sentinel:valid_cloud_cover": true
63+
"sentinel:valid_cloud_cover": true,
64+
"renders": {
65+
"sir": {
66+
"title": "Shortwave Infra-red",
67+
"assets": [
68+
"swir22",
69+
"nir2",
70+
"red"
71+
],
72+
"rescale": [
73+
[
74+
0,
75+
5000
76+
],
77+
[
78+
0,
79+
7000
80+
],
81+
[
82+
0,
83+
9000
84+
]
85+
],
86+
"resampling": "nearest"
87+
}
88+
}
6489
},
6590
"collection": "sentinel-s2-l2a-cogs",
6691
"assets": {
@@ -617,31 +642,6 @@
617642
]
618643
}
619644
},
620-
"renders": {
621-
"sir": {
622-
"title": "Shortwave Infra-red",
623-
"assets": [
624-
"swir22",
625-
"nir2",
626-
"red"
627-
],
628-
"rescale": [
629-
[
630-
0,
631-
5000
632-
],
633-
[
634-
0,
635-
7000
636-
],
637-
[
638-
0,
639-
9000
640-
]
641-
],
642-
"resampling": "nearest"
643-
}
644-
},
645645
"links": [
646646
{
647647
"rel": "collection",

json-schema/schema.json

+13-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"description": "STAC Rendering Extension for STAC Items and STAC Collections.",
66
"oneOf": [
77
{
8-
"$comment": "This is the schema for STAC Items. Remove this object if this extension only applies to Collections.",
8+
"$comment": "This is the schema for STAC Items.",
99
"allOf": [
1010
{
1111
"$ref": "#/definitions/stac_extensions"
@@ -14,18 +14,23 @@
1414
"type": "object",
1515
"required": [
1616
"type",
17-
"assets",
18-
"renders"
17+
"properties",
18+
"assets"
1919
],
2020
"properties": {
2121
"type": {
2222
"const": "Feature"
2323
},
24-
"renders": {
25-
"$comment": "This validates the fields in Item Assets, but does not require them.",
24+
"properties": {
2625
"type": "object",
27-
"additionalProperties": {
28-
"$ref": "#/definitions/fields"
26+
"required": ["renders"],
27+
"properties": {
28+
"renders": {
29+
"type": "object",
30+
"additionalProperties": {
31+
"$ref": "#/definitions/fields"
32+
}
33+
}
2934
}
3035
}
3136
}
@@ -161,7 +166,7 @@
161166
"type": "number"
162167
}
163168
},
164-
"bidx":{
169+
"bidx": {
165170
"type": "array",
166171
"items": {
167172
"type": "number"

0 commit comments

Comments
 (0)