Skip to content

Commit d6b395d

Browse files
lhoupertclaude
andcommitted
fix(docs): show the no-data part of Sentinel-2 previews as transparent
STAC Browser draws an item's `preview` COG, the asset with the `overview` role. Earth Search's preview declares no no-data value, so the empty part of a partially covered tile came out black (97% of it on S2B_T39QWD_20250413T071904_L2A). - Notebook 02 marks 0 as the preview's no-data value before loading the items. ol-stac passes it to OpenLayers, which draws those pixels transparent. - STAC Browser gets SB_displayOverviewsForChildren=true in the chart and in both compose files. Collection and search pages, such as the one notebook 02 embeds, then draw the preview COG instead of the JPEG thumbnail, which can't be transparent. Verified against stac-browser 5.1.0 in Chrome and Firefox: the black share of the no-data area dropped from 0.97 to 0. The field survives pypgstac upsert, stac-fastapi and stac-auth-proxy unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 5fc7fa5 commit d6b395d

4 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎docker-compose.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ services:
195195
- 8080:8080
196196
environment:
197197
SB_catalogUrl: "http://localhost:8084"
198+
# draw items' preview COGs (no-data transparent) on collection pages, not JPEG thumbnails
199+
SB_displayOverviewsForChildren: "true"
198200
# # Chapter 8: log in against the mock OIDC server. `historyMode` must be
199201
# # "history" for OIDC (it is STAC Browser's default), and the redirect URI is
200202
# # always <browser origin>/auth -- here http://localhost:8080/auth.

‎docs/02-database.ipynb‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@
243243
"id": "34af967a-b837-4910-afde-6145582cf216",
244244
"metadata": {},
245245
"source": [
246-
"You are going to upload these items to the items table in the `pgstac` database but to do so you need to make sure the items' collection ID matches an existing collection - set it to match the collection that you uploaded in the previous step."
246+
"You are going to upload these items to the items table in the `pgstac` database but to do so you need to make sure the items' collection ID matches an existing collection - set it to match the collection that you uploaded in the previous step.\n",
247+
"\nEarth Search's `preview` image of each item declares no no-data value, so STAC Browser would draw the empty part of a partially covered tile in black. Marking `0` as its no-data value makes that part transparent."
247248
]
248249
},
249250
{
@@ -256,6 +257,10 @@
256257
"# override the collection id to match your new collection\n",
257258
"for item in items:\n",
258259
" item.set_collection(my_collection)\n",
260+
" # the `preview` image declares no no-data value: mark 0 so STAC Browser\n",
261+
" # draws the empty part of the tile transparent instead of black\n",
262+
" if \"preview\" in item.assets:\n",
263+
" item.assets[\"preview\"].extra_fields[\"nodata\"] = 0\n",
259264
"\n",
260265
"items[0]"
261266
]

‎participant/chart/values.yaml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ containers:
194194
env:
195195
SB_pathPrefix: /browser/
196196
SB_catalogUrl: "{origin}/stac/"
197+
# draw items' preview COGs (no-data transparent) on collection pages, not JPEG thumbnails
198+
SB_displayOverviewsForChildren: "true"
197199
SB_authConfig: >-
198200
{"type":"openIdConnect",
199201
"openIdConnectUrl":"{origin}/oidc/.well-known/openid-configuration",

‎participant/compose.participant.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ services:
192192
environment:
193193
SB_pathPrefix: /browser/
194194
SB_catalogUrl: http://localhost:18888/stac/
195+
# draw items' preview COGs (no-data transparent) on collection pages, not JPEG thumbnails
196+
SB_displayOverviewsForChildren: "true"
195197
# Chapter 8 login against this stack's mock-oidc. The redirect URI is
196198
# <origin><pathPrefix>auth = http://localhost:18888/browser/auth.
197199
SB_authConfig: >-

0 commit comments

Comments
 (0)