Global Mapper v25.0

Load layer dialog

nickgoodliff
nickgoodliff Global Mapper UserTrusted User
edited July 2014 in SDK
Hi Mike

I've got some .img files that I am loading in as layers, which is prompting the following dialog:

[FONT=&quot]The characteristics of the data set DTM_5m_Aspect_TQ27.img could not be automatically determined. Specify the type of the data by pressing the appropriate button below.

YES - gridded (i.e. elevation) data
NO - imagery/raster data

The correct type is NO - imagery/raster. Is there a way to pass this 'NO' automatically without the prompt?

Cheers
Nick[/FONT]

Comments

  • global_mapper
    global_mapper Administrator
    edited July 2014
    Nick,

    Yes, you can use GM_LoadLayerListEx and pass in "1" for the aExtraLoadOptions string. The 1 indicates that the type was prompted for and imagery was selected. A value of "3" automatically selects elevation data.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • nickgoodliff
    nickgoodliff Global Mapper User Trusted User
    edited July 2014
    That's brilliant, thanks Mike. I'm getting a crash when "Loading optimum palette" dialog appears when I am exporting the data to an 8bit TIFF - stays at 0% then my app exits. Is there any way to find out why? I am using GM_ExportRasterEx.

    Nick
  • global_mapper
    global_mapper Administrator
    edited July 2014
    Nick,

    What version of the SDK are you using? Can you try getting the latest SDK (just released v15.2.6) from Global Mapper SDK Downloads and see if it has the same issue?

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • nickgoodliff
    nickgoodliff Global Mapper User Trusted User
    edited July 2014
    I was on 15.1 - just upgraded it to latest but still happens.

    I understand that "Loading Optimum palette" does an first export and then another with the optimum palette? I get a file outputted that is only 1k and corrupt so something happening here I think.

    Nick
  • global_mapper
    global_mapper Administrator
    edited July 2014
    Nick,

    The find optimum palette runs through the export to build an optimum palette, but doesn't write a file. Once it builds the optimum palette it then does the full export.

    If you run the latest GM application from Global Mapper Downloads with your data and export to an 8-bit GeoTIFF with an optimum palette do you get the same error or is it fine? If you get the error, can you provide the data you are using? If no error, can you provide your GM_ExportRasterEx call?

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • nickgoodliff
    nickgoodliff Global Mapper User Trusted User
    edited July 2014
    I think it's just this particular data - other laters are exporting fine. Can I turn off "optimum palette"?

    My GM_ExportRasterEx call is:

    [/COLOR]public bool SaveLayer8BitTiff(string storagePath, GM_Rectangle_t ExportRect, double StoreRatio)        {
                GlobalMapperDLL.GM_Error_t32 gMErrorT32 = GlobalMapperDLL.GM_Error_t32.GM_Error_None;
                gMErrorT32 = GlobalMapperDLL.GM_ExportRasterEx(storagePath,
                    GlobalMapperDLL.GM_RasterExportFormat_t32.GM_Export_GeoTIFF,
                    IntPtr.Zero,
                    0,
                    ref ExportRect,
                    (int)(StoreRatio * (ExportRect.mMaxX - ExportRect.mMinX)),
                    (int)(StoreRatio * (ExportRect.mMaxY - ExportRect.mMinY)),
                    GlobalMapperDLL.GM_RasterExportFlags_t32.GM_ExportFlags_GenWorldFile | GlobalMapperDLL.GM_RasterExportFlags_t32.GM_ExportFlags_Palette,
                    "QUALITY=95");
                if (gMErrorT32 == GlobalMapperDLL.GM_Error_t32.GM_Error_None)
                {
                    return true;
                }
                else
                {
                    throw new Exception(gMErrorT32.ToString());
                }
    
            }[COLOR=#333333]
    

    What's the best way to securely get you some example data?

    Cheers
    Nick
  • samknight
    samknight BMG Staff
    edited July 2014
    Hi Nick,
    I just PM'ed you some FTP info, if you could let us know when your upload is complete, we'll take a look.
    Regards,
    Sam Knight
    Director of Product Management
    Blue Marble Geographics
  • PShorey
    PShorey Global Mapper Developer Moderator, Trusted User
    edited July 2014
    Nick,

    When exporting as 8-bit GeoTiff, we must create an optimized palette. You can essentially turn this off by not setting the GM_ExportFlags_Palette flag. A 24-bit RGB GeoTiff will be exported in that case. I don't know if that is an option for you. We received some sample data: DTM_5m_Aspect_NY51.img and DTM_5m_Slope_NY51.img. I was not able to load the first file, and am looking into that now. I was however able to load and export the second file as an 8-bit GeoTiff. Do you know which file is causing the optimized palette issue, and could you provide us with a copy?
  • nickgoodliff
    nickgoodliff Global Mapper User Trusted User
    edited July 2014
    It is the first "Aspect" file that is causing the issues.

    As mentioned by my colleague Graham via email, these are actually 16-bit rasters as they have palettes with values ranging from 0-360 (i.e. more than 8-bit). So we need to find a way to export them as GeoTIFFs with palettes (so the 24bit RGB is not an option), but able to deal with more values than an 8-bit. Any ideas? Apparently ArcGIS and QGIS don't have any issue here and hopefully it is just a small update for you to be able to have bigger palettes.

    Nick
  • PShorey
    PShorey Global Mapper Developer Moderator, Trusted User
    edited July 2014
    Nick,

    I have placed a new build of the SDK here:
    http://www.globalmapper.com/GlobalMapperSDK_v15_latest_beta.zip

    It corrects the 16-bit IMG load and palette issues. I was able to export both your sample IMG file to GeoTiff without error. To use a custom palette, as Graham asked about via email, try the GM_SetLayerPalette function.

    Let me know if I can be of further assistance.
    Peter