Skip to content

Add overview (pyramid) generation for Cloud-Optimized GeoTIFF output #1150

@brendancol

Description

@brendancol

to_geotiff() can write GeoTIFFs, but production Cloud-Optimized GeoTIFFs need internal overviews (image pyramids) for efficient tiled access at multiple zoom levels. Without overviews, COGs written by xarray-spatial still need a post-processing step through GDAL (gdaladdo) to be truly usable, which defeats the purpose of having native I/O.

Scope

  • Generate 2x downsampled overviews and embed them in the output GeoTIFF.
  • Configurable number of overview levels, or auto-calculate based on raster dimensions (keep halving until the smallest overview fits in a single tile).
  • Resampling method per overview level:
    • nearest for categorical data
    • average for continuous data
    • mode for majority-class downsampling
    • Similar to what gdaladdo provides.
  • Integrate with the existing to_geotiff() / write_geotiff_gpu() pipeline so users get proper COGs in one call instead of writing a flat TIFF and running a separate tool.

Current workaround

Write a GeoTIFF with xarray-spatial, then shell out to gdaladdo and gdal_translate -of COG to add overviews and restructure. This adds a hard GDAL dependency and creates intermediate files.

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