Skip to content

GeoZarr / Zarr v3 reflectance support (experimental)#283

Draft
wietzesuijker wants to merge 1 commit intostac-utils:mainfrom
wietzesuijker:feat/geozarr-zarrv3-reflectance-support
Draft

GeoZarr / Zarr v3 reflectance support (experimental)#283
wietzesuijker wants to merge 1 commit intostac-utils:mainfrom
wietzesuijker:feat/geozarr-zarrv3-reflectance-support

Conversation

@wietzesuijker
Copy link

@wietzesuijker wietzesuijker commented Jan 7, 2026

Why

STAC catalogs typically distribute satellite raster data as Cloud Optimized GeoTIFF (COG) assets, which GIS software such as QGIS can stream efficiently.

Within EOPF, there is ongoing progress toward a more cloud-native distribution using GeoZarr / Zarr v3. However, most GIS tooling does not (yet) support this format well in practice because it is new, and the data is chunked into many (often sparsely accessed) blobs, which changes access patterns and can trigger a large number of small remote reads.

Summary

This PR adds experimental support for Zarr v3 / GeoZarr reflectance assets so they can be visualized in QGIS quickly (XYZ preview) and inspected for values (GDAL VRT-backed raster "data" layer). The aim for now is to gather feedback for further development. See screen recording for a quick demo that loads a stac item and visualizes a preview of the data + raster pixel values (the preview/xyz layer is at the bottom and the "data" layer at the top).

stac-qgis-geozarrv3.mp4

User-facing behavior

  • Zarr media types are treated as loadable raster assets.
  • When adding a reflectance Zarr asset:
    • If the STAC item includes an xyz link and the asset roles include reflectance, the plugin adds a fast XYZ preview layer ((preview)), then adds a separate raster data layer ((data)) built from a GDAL VRT and hides it by default.
    • Otherwise, the plugin adds a single raster layer backed by a generated VRT.

Implementation details

  • Dependency bootstrap: force the plugin’s vendored lib/ to load first (so QGIS’ bundled packages don’t override it).
  • Zarr detection: recognize Zarr/GeoZarr media types (e.g. application/vnd+zarr) and treat them as raster assets.
  • GeoZarr → VRT: build a temporary GDAL VRT that points at band zarr.json endpoints.
  • Georeferencing: if projection metadata is present on the item, write it into the VRT.
    • Uses proj:epsg / proj:code + a 6-value proj:transform (GDAL GeoTransform).
  • Layer visibility: supports adding the VRT-backed “data” layer hidden by default when a “preview” layer is also added.
  • TODO: fix QGIS warnings on sharding (WARNING Surface Reflectance (data) : Sharded chunk range out of bounds)

Testing notes

  • Manual: in QGIS, add an item with a reflectance Zarr asset and an xyz link.
    • Local install (run this PR version in QGIS):
      1. Close QGIS.

      2. Find your QGIS profile plugin folder:

        • macOS (default profile): ~/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/qgis_stac
        • Linux (default profile): ~/.local/share/QGIS/QGIS3/profiles/default/python/plugins/qgis_stac
        • Windows (default profile): %APPDATA%\QGIS\QGIS3\profiles\default\python\plugins\qgis_stac
      3. Back up the installed plugin folder.

      4. Overlay this repo’s code from qgis-stac-plugin/src/qgis_stac onto the installed qgis_stac folder, preserving metadata.txt.

        Example (macOS/Linux) using rsync:

        PLUGIN_BASE="$HOME/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins"
        DEST="$PLUGIN_BASE/qgis_stac"
        SRC="/path/to/qgis-stac-plugin/src/qgis_stac"
        cp -a "$DEST" "$DEST.bak-$(date +%Y%m%d-%H%M%S)"
        rsync -a --delete \
          --exclude "metadata.txt" \
          --exclude "icon.png" \
          --exclude "resources.py" \
          "$SRC/" "$DEST/"
      5. Start QGIS and enable/reload the plugin.

    • Verify (preview) XYZ layer is added quickly.
    • Verify (data) raster layer is added (hidden) and can be toggled on for Identify/value inspection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant