Help with debugging LoadLayerListEx

OseiOsei Global Mapper UserPosts: 119Trusted User
edited May 2014 in SDK
I need help debugging a problem I have with LoadLayerListEx.
I get the following error
Unable to load overlay DEM2.dem
Encountered an improper argument.
OverlayFactory.cpp - 2749
Version: v13.1.0 (32-bit)
Build Time: Mar 21 2012 12:04:35

The problem is the error sometimes does not occur and sometimes, it does occur with the same arguments. I do not see anything wrong with the arguments. I have tried with LoadLayerList and still get the same error.

Is there something that needs to be instantiated before calling the method? What exactly does line 2749 in OverlayFactory.cpp want with respect to arguments?

Thanks

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2014
    It's a bit hard to say as that SDK is so old. The error is just that an exception was thrown during load of the DEM due to some kind of invalid argument calling into a Windows function. My guess is this is related to the creation of a memory mapped file to store the unpacked DEM results if it is a large DEM or there is already a lot of data loaded.

    Have you considered updating to the latest SDK? It would be much simpler to debug in that and quite possibly the issue has gone away in the intervening years. You can get the latest SDK build from http://www.globalmapper.com/GlobalMapperSDK_v15_latest_beta.zip . You would need a new license, but we could provide a trial one.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • OseiOsei Global Mapper User Posts: 119Trusted User
    edited May 2014
    Thanks a lot Mike. I have tried to use the latest SDK and it is also giving me the same problem. It sometimes works and it sometimes doesn't though same arguments are being used. The error message I am getting is similar, as follows

    Unable to load overlay DEM2.dem
    Encountered an improper argument.
    OverlayFactory.cpp - 3263
    Version: v15.1.7 (64-bit)
    Build Time: Mar 2 2014 12:45:33

    Hope this helps in tracing the root of the problem.
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2014
    That is definitely the same error (i.e. catching a CException thrown from the DEM load). What do the parameters that you are passing in look like?

    I have added more error logging in the DEM load to narrow down where this is coming from. I have placed a new SDK build at http://www.globalmapper.com/GlobalMapperSDK_v15_latest_beta.zip for you to try that should show the error during the DEM load and have more information about exactly what step it failed at.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • OseiOsei Global Mapper User Posts: 119Trusted User
    edited May 2014
    Thanks a lot Mike for your help.
    I am calling LoadLayerList(string filename, out IntPtr, out uint numLoadedLayers, GM_LoadFlags 0) and LoadLayerListEx with same parameters and extraLoadOptions = "" (have also tried null)

    The issue is quite intermittent and sometimes happens and sometimes does not. That is what baffles me since I am calling with the same parameters.

    The error message I am now getting is as follows
    Error loading USGS DEM F:\EdenTest\Data\DEM2.dem
    USGSDEMOverlay::load - 1
    Encountered an improper argument.
    USGSDEMOverlay.cpp - 634
    Version: v15.2.0 (64-bit)
    DEM2.zip
    Build Time: May 14 2014 15:03:26


    I have also attached the file.
    DEM2.zip 453.2K
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2014
    The error is either when first opening the DEM from disk or reading the header. I have added more debug logging and also fixed one potential problem is the header read failed. I have placed a new SDK build at http://www.globalmapper.com/GlobalMapperSDK_v15_latest_beta.zip for you to try.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • OseiOsei Global Mapper User Posts: 119Trusted User
    edited May 2014
    I can say the frequency of errors has fallen but I still do get the occasional error as follows

    Error loading USGS DEM F:\EdenTest\Data\DEM2.dem
    Read grid line to pos 581
    Encountered an improper argument.
    USGSDEMOverlay.cpp - 636
    Version: v15.2.0 (64-bit)
    Build Time: May 15 2014 11:04:18
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2014
    It looks like an error creating the memory-mapped file for temporarily storing the data. I have updated the very old DEM code to use the new way the rest of Global Mapper saves file-backed data, so perhaps this will fix the issue. I have updated the SDK at http://www.globalmapper.com/GlobalMapperSDK_v15_latest_beta.zip with the change.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • OseiOsei Global Mapper User Posts: 119Trusted User
    edited May 2014
    I have managed somehow to get the problem not occurring by specifying that the progress dialog be hidden. That seems to have fixed it.
    So in addition to the GM_LoadFlags the user specifies, I add GM_LoadFlags_t32.GM_LoadFlags_HideProgress
    I also specify GM_RasterExportFlags_t32.GM_ExportFlags_HideProgress during export of rasters.

    I don't know how the progress dialog is related to the error although I know turning them off fixes the problem.

    Hope this info helps you in tracing the root cause of the issue.
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2014
    Are you setting a progress callback with GM_SetProgressCallback? Based on that flag disabling the problem it does seem that the progress reporting is the issue. I'm just wondering if you are setting a callback so something in there could be failing in some case. If not there must be something in our progress reporting code that I can catch further down to track.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited May 2014
    I did also add some error checking inside the progress reporting itself to see exactly where it is failing inside the progress code. The new SDK build is at the same place as before.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • OseiOsei Global Mapper User Posts: 119Trusted User
    edited May 2014
    We do not use our own progress callback. We just use the in-built progress dialogs.

    However, your suggestion gave me the idea of setting my own progress callback so that the in-built ones do not show and it has fixed the problem for now.

    So I am guessing the way we call the SDK is incompatible with showing progress dialogs.

    Thanks once again for your help.
Sign In or Register to comment.