developmentseed / developmentseed/titiler
[titiler.xarray] Better support for Multiscale Zarr (Groups)
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 254
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 9
Description
ref: https://github.com/zarr-developers/geozarr-spec/blob/main/geozarr-spec.md#multiscales
### Problem
Right now to read a different `scale` we need to set the `group=` parameter but that needs to append before opening the Zarr file, meaning we cannot dynamically select the corresponding scale based on a required Zoom Level.
https://github.com/developmentseed/titiler/blob/5fab6048387db9bcbb24399ca220a93632ee7b42/src/titiler/xarray/titiler/xarray/io.py#L126-L128
### Solution
We could create a new endpoint similar to the tilejson endpoint which return a list of `(group number, (minzoon, maxzoom))` for a specific TileMatrixSet, which then could be use by a frontend map client to construct the corect tile URL with the correct group value
```js
fetch('/WebMercatorQuad/metadata.json?url=myzarURL.zarr&variable=yo')
{
"scheme": "xyz",
"tiles": [
"/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?url=myzarURL.zarr&variable=yo&group={group}"
],
"minzoom": 0, // Zoom of the low resolution group
"maxzoom": 9, // Zoom of the high resolution group
"bounds": [-180, -90, 180, 90],
"center": [0, 0, 0],
"groups": [
// [group_name, [minzoom, maxzoom]]
[0, [0, 2]],
[1, [2, 4]],
[2, [4, 6]],
[3, [6, 8]],
[4, [8, 10]]
]
}
```
cc @maxrjones @hrodmn @abarciauskas-bgse @sharkinsspatial
Contributor guide
Research direction
Start with src/titiler/xarray/titiler/xarray/io.py at lines 126-128 and inspect the existing tilejson endpoint. Trace how the TileMatrixSet and Zarr group are selected, then define the metadata response so it includes each group and its zoom range. Done means a metadata endpoint can return the groups mapping needed to construct tile URLs dynamically.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100