geotrellis icon indicating copy to clipboard operation
geotrellis copied to clipboard

Rotated rasters support

Open pomadchin opened this issue 4 years ago • 1 comments

At this point GeoTrellis is not able to interop with rotated rasters. In terms of GDAL it means that GeoTrellis doesn't support Rasters with the AffineTransform (upx, xres, xskew, upy, yskew, yres) where xskew and yskew are not 0.

There was introduced at least some (GDAL API) rotation support in terms of #3331. However, it doesn't address this issue, since #3331 just aligns the GDAL Reader and the Java Reader behavior. I.E. RasterExtent is still unable to work with the rotated RasterExtent and expects a different cellSize.

RasterIO for such rasters has a rotated flag in its API. May be this can help us to resolve this issue in the future.

For now the workaround is to remove rasters rotation i.e. via gdalwarp

pomadchin avatar Jan 07 '21 22:01 pomadchin

Translating it to my brain: there are rasters whose pixel grid is rotated/skewed with respect to the the map axis. The mechanical problem is that RasterExtent doesn't model that kind of raster alignment and CellSize is not calculated correctly. The bigger problem is that these kinds of rasters can't be combined with other rasters in the same CRS (which is an assumption we usually make). In reality they need to be "resampled" to rectilinear pixel grids before any cross-raster operations.

Off the cuff I think what need to do is extend the RasterExtent data model to support rotated rasters. Taking care not to combine them improperly might have to fall back on the users, its not really clear how we could support automatic-smart behavior here.

echeipesh avatar Jan 22 '21 15:01 echeipesh