Uploaded image for project: 'Apache Sedona'
  1. Apache Sedona
  2. SEDONA-477

Avoid producing rasters with images having non-zero origins

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.5.2

    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

        1. Untitled Diagram.drawio (1).png
          38 kB
          Kristin Cowalcijk

        Issue Links

          Activity

            People

              Unassigned Unassigned
              kontinuation Kristin Cowalcijk
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m