imageio-ext
  1. imageio-ext
  2. IMAGEIO_EXT-42

Add capability to warp/reproject images on read using gdal.AutoCreateWarpVRT

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: current
    • Fix Version/s: None
    • Component/s: gdal-framework
    • Labels:
      None
    • Environment:

      All

      Description

      The java GDAL bindings support warping a Dataset on the fly when reading an image using gdal.AutoCreateWarpVRT(...).

      http://gdal.org/java/org/gdal/gdal/gdal.html#AutoCreateWarpedVRT(org.gdal.gdal.Dataset,%20java.lang.String,%20java.lang.String,%20int,%20double)

      My suggestion is to modify GDALImageReader.read() to accept a new ImageReadParam extension (GDALImageReadParam) that contains the necessary information to pass to the AutoCreateWaprVRT method. The read method could check if the read param is a GDALImageReadParam and if the source projection is different from the destination projection create a virtual warped dataset from the original dataset.

      This change would allow users of imageio-ext to warp images being read into any projection recognized by gdal.

      1. GDALImageReader.java
        51 kB
        newmanw10
      2. GDALImageReadParam.java
        4 kB
        newmanw10
      3. GeoTiffTest.java
        15 kB
        newmanw10
      4. imageio-42-patch.txt
        21 kB
        newmanw10

        Activity

        Hide
        newmanw10 added a comment - - edited

        Description of attached files:

        GDALImageReader:
        This reader has modifications to check if the ImageReadParam is of type GDALImageReadParam. If so it will check if the destination projection contained in the GDALImageReadParam is different from the source files projection. If it is different it will use the AutoCreateWarpedVRT from the original dataset.

        GDALImageReadParam:
        Extension of ImageReadParam used to pass read parameters specific to reading GDAL images. In this case this class contains parameters needed to warp an image on read.

        GeoTiffTest:
        A new test to pass a GDALImageReadParam with a different projection from the source image and read.

        Show
        newmanw10 added a comment - - edited Description of attached files: GDALImageReader: This reader has modifications to check if the ImageReadParam is of type GDALImageReadParam. If so it will check if the destination projection contained in the GDALImageReadParam is different from the source files projection. If it is different it will use the AutoCreateWarpedVRT from the original dataset. GDALImageReadParam: Extension of ImageReadParam used to pass read parameters specific to reading GDAL images. In this case this class contains parameters needed to warp an image on read. GeoTiffTest: A new test to pass a GDALImageReadParam with a different projection from the source image and read.
        Hide
        newmanw10 added a comment - - edited

        Attached a patch for the modified files. Please ignore the original files attached as there was a small bug. The patch file is correct.

        Show
        newmanw10 added a comment - - edited Attached a patch for the modified files. Please ignore the original files attached as there was a small bug. The patch file is correct.
        Hide
        dany111 added a comment -

        Fixed on trunk. (check the latest github repository on master branch)
        Need some test before porting it to 1.1.x series.

        Show
        dany111 added a comment - Fixed on trunk. (check the latest github repository on master branch) Need some test before porting it to 1.1.x series.

          People

          • Assignee:
            dany111
            Reporter:
            newmanw10
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 2 days
              2d
              Remaining:
              Remaining Estimate - 2 days
              2d
              Logged:
              Time Spent - Not Specified
              Not Specified