Skip to content

allow_rotated does not work for rotated GeoTIFFs #2115

@brendancol

Description

@brendancol

Describe the bug

open_geotiff(..., allow_rotated=True) is documented as an opt-out for rejection of rotated grids (see _validation.py:893), and the VRT reader honours it. The GeoTIFF reader does not.

A rotated TIFF with ModelTransformationTag (34264) containing non-zero off-diagonal terms hits the check at xrspatial/geotiff/_geotags.py:509 and raises NotImplementedError immediately. The downstream validator that consults allow_rotated (_validation.py:875) is never reached. So the kwarg has no effect for the GeoTIFF path, and a user with a rotated raster sees a hard error even when they explicitly opt in to reading it as a pixel grid.

>>> open_geotiff("rotated.tif", allow_rotated=True)
NotImplementedError: ModelTransformationTag (34264) contains rotation, skew, or z-coupling terms ...

Expected behavior

When allow_rotated=True, the GeoTIFF reader should drop the geo affine, treat the pixel grid as ungeoreferenced, and return a DataArray with integer pixel coords -- the same shape the VRT path already supports.

Additional context

  • Local files only is fine for the first cut. The check moves the same way for HTTP / cloud sources, since they share the geotag parser.
  • The validator's existing message already mentions the kwarg, so the failure mode is discoverable; the fix is to actually honour it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    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