developmentseed / developmentseed/lonboard

RasterLayer: expose nearest-neighbor texture filtering for COG rendering

Open
#1,213 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
964
Forks
54
Avg merge
5m
Merged PRs (30d)
1

Description

**Is your feature request related to a problem? Please describe.**
Yes. I am rendering a paletted/categorical COG with `RasterLayer.from_geotiff(..., render_tile=...)`, using the paletted `render_tile` pattern from the Lonboard docs.

When zooming in, the raster is visually smoothed/blurry. Individual source pixels are not clearly distinguishable. For Earth observation and scientific COG exploration, this is undesirable because users often need to inspect the native pixel grid directly and evaluate individual pixels, masks, classifications, QA bands, or small spatial patterns without visual smoothing.

This seems to happen after the PNG tile is produced, when the tile is rendered in the browser as a texture.

**Describe the solution you'd like**
I'd like `RasterLayer` to expose an option for nearest-neighbor texture filtering / disabling image smoothing.

Ideally, this would mirror deck.gl `BitmapLayer` texture parameters, for example:

```python
RasterLayer.from_geotiff(
geotiff,
render_tile=render_tile,
texture_parameters={
"minFilter": "nearest",
"magFilter": "nearest",
},
)
```
Alternatively, a higher-level boolean would also work:
```python
RasterLayer.from_geotiff(
geotiff,
render_tile=render_tile,
image_smoothing=False,
)
```
The important behavior is preserving hard pixel boundaries when raster tiles are magnified on screen.

**Describe alternatives you've considered**
I considered nearest-neighbor upsampling inside render_tile, but that is only a workaround. It increases tile dimensions and payload size, uses more browser texture memory, and changes the tile image rather than controlling how the image is sampled during rendering.

I also considered zoom-related parameters such as zoom_offset, but this only affects which tile/overview level is requested. It does not solve smoothing when a tile is magnified on screen.

**Additional context**
The relevant deck.gl-side behavior appears similar to `BitmapLayer` texture filtering, where `magFilter: "nearest"` / `minFilter: "nearest"` can be used for pixelated rendering.

The screenshot shows the issue at high zoom: the COG is rendered with smooth/interpolated transitions instead of clearly visible native pixel boundaries.

Image

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at RasterLayer.from_geotiff and trace how render_tile output becomes a browser texture, then compare the requested options with deck.gl BitmapLayer texture filtering. Done means RasterLayer accepts a documented filtering option and magnified COG tiles preserve hard pixel boundaries, with coverage for the new behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter, python
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.