GeoTiff Resampling Error

cevelycevely Global Mapper UserPosts: 38Trusted User
edited May 2012 in Bug Report
I have run into an error when re-projecting a 4-band TIF into a new projection. I am using GM v13.1 and grabbed the latest build for my test. NOTE: I tried attaching the files but .TIF is not an accepted file extension so I uploaded to Google Docs and you can download at:
Source: https://docs.google.com/open?id=0B0XNfA00VEquZDRKUTc3MC1weGc
Output: https://docs.google.com/open?id=0B0XNfA00VEquMndzZnA2c0l5UE0

To re-create:
- Open attached "Source" TIF in GM, choosing No when asked to use alpha channel. Projection should be State Plane, KY Single, NAD83, sf.
- Change working projection to State Plane, KY North, NAD83, sf.
- Export GeoTiff
- File Type: Multi-Band, 8 bits, 4 bands
- Resampling: Default (although I tried a few others with similar results)
- Sample Spacing: use defaults, check "Always Generate Square Pixels"
- Compression: No Compression

The attached "Output" tif is what is output from this workflow and the pixel values are getting resampled incorrectly. It almost appears that the tif is gridded into 64x64 blocks and then rotated by a pixel or so... you can see the pattern I'm talking about if you zoom to a road or railroad and toggle between the Source and Output tifs.

Thanks for any help you can give me.

Chad

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2012
    Chad,

    Try setting the resampling to Bilinear Interpolation or Bicubic and see if that helps. It looks like you are just seeing a shift like you would get from nearest neighbor resampling where the sample location hits a half pixel boundary and shifts to the next pixel over. Interpolation would smooth this out so you would see a quick jump of one pixel like that.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • cevelycevely Global Mapper User Posts: 38Trusted User
    edited May 2012
    Mike,

    Thanks for the quick reply. I just tried selecting "Resampling: Bicubic Interpolation" in the Export Geotiff dialog and repeated my test with similar results.

    I've attached a screenshot of the new output file created with bicubic interpolation containing hard-line offsets introduced across the railroad tracks and train cars. Is it possible this resampling option is being ignored and the process is falling back to nearest neighbor?

    BiCubic.jpg

    Chad
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2012
    Chad,

    The new resampling option during export is very new so it is possible there is an issue causing it to be ignored. If you go to the Options dialog for the layer prior to exporting and set the resampling there to bicubic then do the export with the resampling option there set to default does it give the same results?

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • cevelycevely Global Mapper User Posts: 38Trusted User
    edited May 2012
    Mike,

    I loaded the source file, went into the Overlay Control Center, clicked "Options" and set Resampling = "Bicubic Interpolation." I then set my working projection to KY N and exported a TIF trying both "Default" and "Bicubic" as my Resampling options with identically corrupted results as my last screenshot.

    Note that after setting the new working projection, the image appears correctly on screen. The error is only introduced in the raster export.

    Chad
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2012
    Chad,

    I tried your data and was able to find the error. It turns out with the recent changes the multi-band export was always doing nearest neighbor regardless of the resampling settings. Once I fixed that the problem disappeared with even the automatic setting. I have placed a new build at http://www.globalmapper.com/global_mapper13.zip with the latest changes for you to try. Simply download that file and extract the contents into your existing v13.xx installation folder to give it a try. If you are using the 64-bit v13 version there is a new build at http://www.globalmapper.com/global_mapper13_64bit.zip .

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • cevelycevely Global Mapper User Posts: 38Trusted User
    edited May 2012
    Mike,

    That fixed the problem. Thanks for your help. Is there an undocumented flag to allow a script file to set this sampling method during export?

    Thanks again.

    Chad
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2012
    Chad,

    There isn't yet a way to over-ride resampling in the EXPORT_RASTER command (I'll add that though), but you can provide the sampling method for individual layers as part of the IMPORT command for the layer.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • cevelycevely Global Mapper User Posts: 38Trusted User
    edited May 2012
    Setting the sampling method in the Input command accomplished what I needed to do. Thanks again.

    Chad
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2012
    Chad,

    For future reference I went ahead and added support for adding SAMPLING_METHOD to the EXPORT_RASTER and EXPORT_ELEVATION commands so that you can override the sampling spacing directly when exporting.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
Sign In or Register to comment.