Skip to content

Commit fee56cb

Browse files
ibesoragithub-actions[bot]
authored andcommitted
Fix raster-color interpolation when using nearest raster-resampling
GitOrigin-RevId: 69575575185f8e9aede7cecd2c73821a8b001f1d
1 parent 79fad16 commit fee56cb

3 files changed

Lines changed: 48 additions & 1 deletion

File tree

src/render/draw_raster.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ function configureRaster(
525525

526526
let tex = layer.colorRampTexture;
527527
if (!tex) tex = layer.colorRampTexture = new Texture(context, layer.colorRamp, gl.RGBA8);
528-
tex.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);
528+
tex.bind(resampling, gl.CLAMP_TO_EDGE);
529529
}
530530

531531
if (mrt) {
82.1 KB
Loading
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"version": 8,
3+
"metadata": {
4+
"test": {
5+
"height": 256
6+
}
7+
},
8+
"center": [
9+
13.418056,
10+
52.499167
11+
],
12+
"zoom": 16,
13+
"sources": {
14+
"satellite": {
15+
"type": "raster",
16+
"tiles": [
17+
"local://tiles/{z}-{x}-{y}.satellite.png"
18+
],
19+
"maxzoom": 17,
20+
"tileSize": 256
21+
}
22+
},
23+
"layers": [
24+
{
25+
"id": "raster",
26+
"type": "raster",
27+
"source": "satellite",
28+
"paint": {
29+
"raster-fade-duration": 0,
30+
"raster-color": [
31+
"step",
32+
["raster-value"],
33+
"rgba(0, 0, 0, 1.0)",
34+
0.125, "rgba(242, 242, 255, 0.9)",
35+
0.25, "rgba(160, 210, 255, 0.9)",
36+
0.375, "rgba(33, 140, 255, 0.9)",
37+
0.5, "rgba(0, 65, 255, 0.9)",
38+
0.625, "rgba(250, 245, 0, 0.9)",
39+
0.75, "rgba(255, 153, 0, 0.9)",
40+
0.875, "rgba(255, 40, 0, 0.9)",
41+
1, "rgba(180, 0, 104, 0.9)"
42+
],
43+
"raster-resampling": "nearest"
44+
}
45+
}
46+
]
47+
}

0 commit comments

Comments
 (0)