Skip to content

[titiler.xarray] Better support for Multiscale Zarr (Groups) #1071

@vincentsarago

Description

@vincentsarago

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.

# Argument if we're opening a datatree
if group is not None:
xr_open_args["group"] = group

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions