Skip to content

Fix getting tiles from a 3D tiled grid coverage using "ImageTileMatrix" class#43

Open
alexismanin wants to merge 6 commits into
geoapi-4.0from
fix/image-tile-matrix-get-tile
Open

Fix getting tiles from a 3D tiled grid coverage using "ImageTileMatrix" class#43
alexismanin wants to merge 6 commits into
geoapi-4.0from
fix/image-tile-matrix-get-tile

Conversation

@alexismanin
Copy link
Copy Markdown
Contributor

I stumbled upon a bug when trying to use Apache SIS TileMatrixSet API on a Cloud Optimized Geotiff.

The data file was using a 3D CRS (a single temporal slice on EPSG:3857+Time reference system).
Getting tiles failed with an exception, because the underlying engine was ignoring extra dimensions when selecting tiles.

This PR adds a few unit tests that reproduce the problem, and provide a fix that makes "ImageTileMatrix" class able to provide tiles even when using 3D+ CRSs.

Note that the fix tries to be conservative to the previous behavior, and preserve ImageTileMatrix image caching strategy as far as possible.

This PR also adds a slight restriction on ReshapedImage, to prevent it to serve tiles from source image outside of its reshaped boundaries. The restriction is a side-effect of a fix required on ReshapedImage to fix ImageTileMatrix.

… N dimensions.

Previously, tiles from the ImageTileMatrix were assuming that its tiles were set in a 2D space.
However, an ImageTileMatrix can be a 2D slice in higher dimension space (for example, CRS:84 + single elevation coordinate). In such cases, the code that was relying on tile coordinates broke.
…g multidimensional extents

Previously, the code was simply ignoring extra dimensions to only focus on coverage X and Y dimensions.
This causes a serious problem when a user tries to navigate in other dimensions, because the ImageTileMatrix was not able to take proper action to handle it.

This change is as conservative as possible regarding previous caching behavior. We still check if a user request lies in the boundary of the previous user request, to return an already cached image if possible.
The main differences are:

 1. We check all dimensions of user extent: If user requests tiles in a different additional cell/extent, we reprocess a fresh image
 2. We try to split input multidimensional requests into separate 2D slices, to remain on a "per image" loading strategy.
@alexismanin alexismanin requested a review from desruisseaux May 20, 2026 10:45
@desruisseaux desruisseaux self-assigned this May 20, 2026
@desruisseaux desruisseaux added this to the 1.7 milestone May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants