You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sedona.apache.org by "Kristin Cowalcijk (Jira)" <ji...@apache.org> on 2024/02/02 02:36:00 UTC

[jira] [Created] (SEDONA-477) Avoid producing rasters with images having non-zero origins

Kristin Cowalcijk created SEDONA-477:
----------------------------------------

             Summary: Avoid producing rasters with images having non-zero origins
                 Key: SEDONA-477
                 URL: https://issues.apache.org/jira/browse/SEDONA-477
             Project: Apache Sedona
          Issue Type: Bug
            Reporter: Kristin Cowalcijk
             Fix For: 1.6.0
         Attachments: Untitled Diagram.drawio (1).png

{{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.





--
This message was sent by Atlassian Jira
(v8.20.10#820010)