Skip to content

Commit 64d5f02

Browse files
Mark KorverMark Korver
authored andcommitted
viewer: show native-resolution status in the layer panel
The collection's native zoom — the Web-Mercator zoom where one screen pixel maps to ~one source COG pixel — was only implicit (used by the tile-timing overlay's "over +N" label). Make it explicit in the right-side layer panel: - At native zoom: "★ native resolution · zNN · 1:1 pixels" (green). - Off native: "native zNN · ±N · upsampled/downsampled" (muted). So a user can tell at a glance whether they're seeing true native detail, stretched imagery (above native), or averaged-down imagery (below native). Also documents NATIVE_ZOOM at its definition site — the scanner derives it per COG from ground sample distance and stores the collection median in collections.json.
1 parent 4cf30b5 commit 64d5f02

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

viewer/index.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,11 @@ <h4>Viewer links</h4>
271271
/* ---- constants derived from viewer config ---- */
272272
const IMAGERY_MIN_ZOOM = VIEWER_CONFIG.imageryMinZoom || 18;
273273
const IMAGERY_MAX_ZOOM = VIEWER_CONFIG.imageryMaxZoom || Math.max(22, IMAGERY_MIN_ZOOM + 1);
274+
// NATIVE_ZOOM: the Web-Mercator zoom level where one screen pixel maps
275+
// to ~one source COG pixel (1:1). The scanner computes this per COG
276+
// from ground sample distance and stores the collection median in
277+
// collections.json → viewer config. Surfaced in the layer panel so a
278+
// user can tell when they're viewing imagery at true native detail.
274279
const NATIVE_ZOOM = VIEWER_CONFIG.nativeZoom || (IMAGERY_MIN_ZOOM + 4);
275280
const COG_LABEL_MIN_ZOOM = 15;
276281
// collectionId drives the WFS layer name: cog-extents-{collectionId}
@@ -588,6 +593,25 @@ <h4>Viewer links</h4>
588593
html += '<div class="layer-row" style="color:#aaa;padding-left:18px">zoom in for imagery</div>';
589594
}
590595
html += '<div class="layer-row" style="color:#888;padding-left:18px;font-size:11px">zoom: ' + zoom + '</div>';
596+
597+
// Native-resolution indicator. NATIVE_ZOOM is the median Web-Mercator
598+
// zoom level at which one screen pixel maps to ~one source COG pixel —
599+
// the scanner derives it per COG from ground sample distance and takes
600+
// the collection median. At that zoom the imagery is shown 1:1; above
601+
// it the imagery is upsampled (no extra real detail); below it the
602+
// imagery is downsampled.
603+
var dz = zoom - NATIVE_ZOOM;
604+
if (dz === 0) {
605+
html += '<div class="layer-row" style="padding-left:18px;font-size:11px;'
606+
+ 'color:#1a7f37;font-weight:600">★ native resolution · z'
607+
+ NATIVE_ZOOM + ' · 1:1 pixels</div>';
608+
} else {
609+
var rel = dz > 0
610+
? '+' + dz + ' · upsampled'
611+
: dz + ' · downsampled';
612+
html += '<div class="layer-row" style="padding-left:18px;font-size:11px;'
613+
+ 'color:#999">native z' + NATIVE_ZOOM + ' · ' + rel + '</div>';
614+
}
591615
document.getElementById('layer-info').innerHTML = html;
592616
}
593617

0 commit comments

Comments
 (0)