fix(map): keep bathymetry visible when overzooming

This commit is contained in:
htlee 2026-02-15 18:55:57 +09:00
부모 dc702728be
커밋 0899223c75

파일 보기

@ -859,7 +859,8 @@ function injectOceanBathymetryLayers(style: StyleSpecification, maptilerKey: str
// which may exceed MapLibre's per-segment 16-bit vertex limit and render incorrectly. // which may exceed MapLibre's per-segment 16-bit vertex limit and render incorrectly.
// We keep the fill starting at a more reasonable zoom. // We keep the fill starting at a more reasonable zoom.
minzoom: 6, minzoom: 6,
maxzoom: 12, // Source maxzoom is 12, but we allow overzoom so the bathymetry doesn't disappear when zooming in.
maxzoom: 24,
paint: { paint: {
// Dark-mode friendly palette (shallow = slightly brighter; deep = near-black). // Dark-mode friendly palette (shallow = slightly brighter; deep = near-black).
"fill-color": bathyFillColor, "fill-color": bathyFillColor,
@ -875,7 +876,7 @@ function injectOceanBathymetryLayers(style: StyleSpecification, maptilerKey: str
source: oceanSourceId, source: oceanSourceId,
"source-layer": "contour", "source-layer": "contour",
minzoom: 6, minzoom: 6,
maxzoom: 14, maxzoom: 24,
paint: { paint: {
"line-color": "rgba(255,255,255,0.06)", "line-color": "rgba(255,255,255,0.06)",
"line-opacity": ["interpolate", ["linear"], ["zoom"], 4, 0.12, 8, 0.18, 12, 0.22], "line-opacity": ["interpolate", ["linear"], ["zoom"], 4, 0.12, 8, 0.18, 12, 0.22],
@ -923,7 +924,7 @@ function injectOceanBathymetryLayers(style: StyleSpecification, maptilerKey: str
source: oceanSourceId, source: oceanSourceId,
"source-layer": "contour_line", "source-layer": "contour_line",
minzoom: 8, minzoom: 8,
maxzoom: 14, maxzoom: 24,
filter: bathyMajorDepthFilter as unknown as unknown[], filter: bathyMajorDepthFilter as unknown as unknown[],
paint: { paint: {
"line-color": "rgba(255,255,255,0.16)", "line-color": "rgba(255,255,255,0.16)",
@ -939,7 +940,7 @@ function injectOceanBathymetryLayers(style: StyleSpecification, maptilerKey: str
source: oceanSourceId, source: oceanSourceId,
"source-layer": "contour", "source-layer": "contour",
minzoom: 4, minzoom: 4,
maxzoom: 14, maxzoom: 24,
filter: bathyMajorDepthFilter as unknown as unknown[], filter: bathyMajorDepthFilter as unknown as unknown[],
paint: { paint: {
"line-color": "rgba(255,255,255,0.14)", "line-color": "rgba(255,255,255,0.14)",
@ -1031,9 +1032,11 @@ type BathyZoomRange = {
}; };
const BATHY_ZOOM_RANGES: BathyZoomRange[] = [ const BATHY_ZOOM_RANGES: BathyZoomRange[] = [
{ id: "bathymetry-fill", mercator: [6, 12], globe: [8, 12] }, // MapTiler Ocean tiles maxzoom=12; beyond that we overzoom the z12 geometry.
{ id: "bathymetry-borders", mercator: [6, 14], globe: [8, 14] }, // Keep rendering at high zoom so the sea doesn't revert to the basemap's flat water color.
{ id: "bathymetry-borders-major", mercator: [4, 14], globe: [8, 14] }, { id: "bathymetry-fill", mercator: [6, 24], globe: [8, 24] },
{ id: "bathymetry-borders", mercator: [6, 24], globe: [8, 24] },
{ id: "bathymetry-borders-major", mercator: [4, 24], globe: [8, 24] },
]; ];
function applyBathymetryZoomProfile(map: maplibregl.Map, baseMap: BaseMapId, projection: MapProjectionId) { function applyBathymetryZoomProfile(map: maplibregl.Map, baseMap: BaseMapId, projection: MapProjectionId) {