Skip to content

RasterLayer: expose nearest-neighbor texture filtering for COG rendering #1213

Description

@MarkusTomio

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:

RasterLayer.from_geotiff(
    geotiff,
    render_tile=render_tile,
    texture_parameters={
        "minFilter": "nearest",
        "magFilter": "nearest",
    },
)

Alternatively, a higher-level boolean would also work:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions