Global Mapper v25.0

GeoTIFF compression doesn't seem to work

James Cox
James Cox Global Mapper UserTrusted User
edited January 2013 in SDK
Hi again,

I'm trying to implement optional compression in GeoTIFFs.
When I call into GM_ExportElevation, I pass in GM_RasterExportFlags_t32.GM_ExportFlags_UseLZW, or GM_RasterExportFlags_t32.GM_ExportFlags_JPGinTIFF, or nothing.

However, all three types of output are the exact same size and when I open them in Global Mapper application, I can see in the layer metadata that compression is "None".

The input layer is a GMG, could that have anything to do with it?

Cheers,
James

Comments

  • global_mapper
    global_mapper Administrator
    edited December 2012
    James,

    You are correct that those flags were being ignored. I have updated this so that the GM_ExportFlags_UseLZW flags works. The JPG-in-TIFF only applies to RGB export so it doesn't work for elevation files. I have placed a new SDK build with the working LZW compression at http://www.globalmapper.com/GlobalMapperSDK_v14_latest_beta.zip .

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.bluemarblegeo.com/products/global-mapper.php
  • James Cox
    James Cox Global Mapper User Trusted User
    edited January 2013
    Hi Mike,

    Happy new year!
    I finally upgraded to the latest beta and got LZW compression working as expected.

    One additional question I had was some (mis?)conceptions obtained from this thread:
    http://www.globalmapperforum.com/forums/suggestion-box/6253-geotiff-export.html

    I expected that JPG-in-TIFF would work for elevations, and that ZIP compression would be an option as well. Am I way off on this?

    Thanks again,
    James
  • global_mapper
    global_mapper Administrator
    edited January 2013
    James,

    The JPEG-in-TIFF compression is only for 3-band RGB images, so it doesn't apply for elevation data which is just a single band of 16-bit integer or 32-bit floating point values.

    The DEFLATE compression is what you would use for the same compression algorithm that ZIP uses. Is that what you are using?

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.bluemarblegeo.com/
  • James Cox
    James Cox Global Mapper User Trusted User
    edited January 2013
    JPEG: thanks for the explanation, I didn't realise the difference there. No worries.

    LZW: Forgot to mention in my previous post that I tried the LZW flag on the latest beta and it works fine now. Thanks for that.

    ZIP: I was expecting there would be a flag in GM_RasterExportFlags_t32 to enable this option when exporting GeoTIFF elevation, as there is for LZW?
  • global_mapper
    global_mapper Administrator
    edited January 2013
    I have added a new GM_ExportFlags_UseDeflate flag so you can use that in the SDK. I have placed a new build at http://www.globalmapper.com/GlobalMapperSDK_v14_latest_beta.zip for you to try.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.bluemarblegeo.com/
  • James Cox
    James Cox Global Mapper User Trusted User
    edited January 2013
    That's brilliant, thanks very much!

    For information's sake, I tested out the options for a sample in my app (which is a few small tiles of high res data overlayed onto a large tile of low res data, then cropped and rendered to a middling res.)

    No compression: 12,022,450 bytes
    LZW compression: 4,283,830 bytes
    Zip compression: 2,043,674 bytes