Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
Description
RS_Clip may produce GridCoverage2D objects containing a PlanarImage with non-zero origin. AWT allows images to have a non-zero origin, and RS_Clip apply a mosaic operation on the original image to cut off its visible area. The pixel coordinates of the visible area remain unchanged, only the valid ranges of pixel coordinates were changed. The ranges of valid pixel coordinates are represented by the minX, minY, width, and height properties of the AWT image.
AWT images with non-zero origins bring a full range of problems when handling such GridCoverage2D objects, because lots of band operation code assumes that the images have zero origin, and the BufferedImage of AWT also does not allow images with non-zero origin, which makes it difficult to construct image objects from in-memory buffer.
We decided to make all GridCoverage2D objects have zero origin, rather than fixing all band operation routines to make them handle non-zero origins correctly since this is very difficult. We defined a helper function RasterUtils.shiftRasterToZeroOrigin to shift the raster with non-zero origin to have zero origin, and shift the affine transformation to cancel with the origin shift, thus keeping the actual grid coverage unchanged. Please refer to the attached figure for how it works.
Attachments
Attachments
Issue Links
- links to