Re: Why does Dataset.transform return the identity matrix if there is no geotransform?

Sean Gillies


Yes, we're following GDAL, which returns an identity matrix instead of NULL.

GDAL's design decision has complicated things for rasterio. See the discussion in for example.

On Mon, Oct 18, 2021 at 8:18 AM <interdimensional.cabbage@...> wrote:
I have been reading -> modifying -> writing some GeoTiffs and I got bit by Dataset.transform returning the identity transform. There's a big difference between there being no geotransform and there being the identity geotransform.

The result of this discrepancy is that if if you simply try to copy the transform from the source dataset to the destination dataset, it now has completely incorrect information. There are work arounds; you can detect that it's the identity and set it back to None. But this seems like an unnecessary asymmetry in reading/writing.

I was thinking of raising an issue on GitHub, but I figured I'd ask first. Is there any reason that Dataset.transform should return Affine.identity() instead of None? Is it to match GDAL in some way?

Sean Gillies

Join to automatically receive all group messages.