mapbox / mapbox/mapbox-gl-js

Raster layer paint raster resampling set to nearest does not work as expected

Open
#13,196 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs information :pray:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**mapbox-gl-js version**:
v3.4.0

**browser**:
Chrome 125

### Steps to Trigger Behavior

1. Upload a raster file ([file used in example can be found here](https://inzenl.com/raster.tiff))
2. Add the raster source with this file to mapbox
3. Add the raster layer *with "paint"."raster-resampling" set to "nearest"*
4. Zoom in

### Link to Demonstration

https://jsbin.com/bekoxekoqi/edit?html,js,output

### Expected Behavior
Mapbox should display something like this (taken from QGIS)
![image](https://github.com/mapbox/mapbox-gl-js/assets/2505862/024e3a8f-109a-4087-802f-285514c38e2b)

### Actual Behavior
It still seems to do *some* type of linear scaling
![image](https://github.com/mapbox/mapbox-gl-js/assets/2505862/f9a1c654-972b-400f-b867-abf61789e45d)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior using the linked JSBin, the raster.tiff example, and mapbox-gl-js v3.4.0 in Chrome 125, then inspect the raster layer handling for the raster-resampling paint setting. Done means a raster layer configured with "nearest" displays nearest-neighbor sampling when zoomed in, rather than the observed linear scaling.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.