Exporting a geotif raster with overviews/pyramids

Yann DUPUY
Yann DUPUY Global Mapper UserTrusted User

Hi,

I'm trying to export a huge raster (eg 25000x19000 or even bigger) or a lot of smaller ones (let's say 2048x2048) using the GM_ExportRasterEx c++ function. I really need to create the overviews to speed up the display of these exported orthophotographies.

Using SDK 26, I tried

status = GM_ExportRasterEx(newName, GM_Export_GeoTIFF, &rasterLayerInfo._layer, 1, &bounds, width, height, GM_ExportFlags_UseLZW, "ADD_OVERVIEW_LAYERS=YES");

using the "ADD_OVERVIEW_LAYERS=YES" option found somewhere in this forum, but it does not seem to be working.

I also tried

GM_SetMiscOption(GM_MiscOpt_GeoTIFFExportOverview, 1);

but that's not any better.

I guess I missed something ?

Thanks,

Yann

Best Answers

  • bmg_mike
    bmg_mike Global Mapper Guru Moderator, Trusted User
    Answer ✓

    Hi Yann,

    I took a look and found that there is not a way to specify that overview layers should be included for GeoTIFF export using the GM_ExportRasterEx command. I have created a new task (GMSDK-649) for adding this capability.

    In the meantime, you can achieve that by using the GM_RunScript function that uses an EXPORT_RASTER script command with the ADD_OVERVIEW_LAYERS=YES parameter added. See https://www.bluemarblegeo.com/knowledgebase/global-mapper/cmd/EXPORT_RASTER.htm?tocpath=Global%20Mapper%20Script%7CGlobal%20Mapper%20Scripting%20Reference%7CExport%7C_____9 for documentation of that script command.

    Thanks,

    Mike

    Global Mapper Guru

  • bmg_mike
    bmg_mike Global Mapper Guru Moderator, Trusted User
    Answer ✓

    Right now there isn't any way to control which overviews are written. We will add overview layers at powers of 2 under the initial image size until the first one is below 1,000,000 pixels. I can create a ticket to add a way to customize the minimum pixel level to create overviews to though.

    Thanks,

    Mike

    Global Mapper Guru

Answers

  • Yann DUPUY
    Yann DUPUY Global Mapper User Trusted User

    It seems to be working using GM_Export_Erdas_Imagine instead of GM_Export_GeoTIFF. Is it limited to that specific format ?

  • Yann DUPUY
    Yann DUPUY Global Mapper User Trusted User

    Hi Mike.

    Would you happen to know if there is a hidden option to set the required overview levels in the script command ? I was unable to find any in the documentation.

    Default behavior seems to create pyramids 1024x1024 and 512x512 for my 2048x2048 textures, but I would greatly benefit from smaller ones (down to 64x64 or 32x32).

    Thanks again.

  • Yann DUPUY
    Yann DUPUY Global Mapper User Trusted User

    Hi Mike,

    I noticed that gdal.dll is provided within the GlobalMapper SDK environment, so I decided to use the GDALDataSe::BuildOverviews method, which gives me full control on the pyramids parameters.

    Thanks again for your help,

    Yann