Global Mapper v25.0

Gm_CloseLayer problem with not raster data layer

dana5dana
dana5dana Global Mapper UserTrusted User
edited April 2012 in Raster Data
Hello,

I have a problem when the layer has layerInfo->mHasRasterData property as 0 (false) the GM_CloseLayer() function never ends.

What is the sollution to close the layer?

Thank you,
Dana

Comments

  • dana5dana
    dana5dana Global Mapper User Trusted User
    edited April 2012
    I have a question about loading lidar (.las) file in global mapper sdk. Is there a way to load it as in ascii case (GM_LoadGenericAsciiTextLayer ) using an info (similar to (const GM_AsciiFormatInfo_t* aFormatInfo) to prevent the window with choices to popup ?

    Thank you,D
    ana
  • global_mapper
    global_mapper Administrator
    edited April 2012
    Dana,

    What type of file do you have loaded that won't close? If you immediately load it with GM_LoadLayerList then close it with GM_CloseLayer does it lock up? Does it fail in the sample application as well?

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • global_mapper
    global_mapper Administrator
    edited April 2012
    Dana,

    For the .las files, use GM_LoadLayerListEx and pass in a string for aExtraLoadOptions that contains the same value as the LOAD_FLAGS parameter for the IMPORT command for a LAS file from a .gmw file that you save from Global Mapper after setting up the options that you want.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • dana5dana
    dana5dana Global Mapper User Trusted User
    edited April 2012
    Dana,

    What type of file do you have loaded that won't close? If you immediately load it with GM_LoadLayerList then close it with GM_CloseLayer does it lock up? Does it fail in the sample application as well?


    Hello again,

    I was trying to load a .las file that is 167MB large.

    Case 1: Has raster data

    raster load.png
    Results:
    raster results.png


    Case 2: Has not raster data
    non raster load.png
    Results:
    non raster results.png


    The code I wrote is:

    void LoadLasFile(char* mapFileName)
    {
    GM_LayerHandle_t32* theLayerHandleList = NULL;
    uint32 theNumLayersLoaded = 0;
    GM_Error_t32 theError;
    clock_t startClose, endClose, startOverall,endOverall;

    startOverall = clock();
    theError = GM_LoadLayerList(mapFileName, &theLayerHandleList, &theNumLayersLoaded, GM_LoadFlags_HideWarnings);
    GM_LayerHandle_t32 theLayer = theLayerHandleList[0];
    const GM_LayerInfo_t* layerInfo = GM_GetLayerInfo(theLayer);

    printf("Has raster data: %d \n", layerInfo->mHasRasterData);
    if(theLayer!=NULL)
    {

    theError = GM_FlushLayerCache(theLayer);

    startClose = clock();
    theError = GM_CloseLayer(theLayer);
    endClose = clock();
    printf("Time required for GM_CloseLayer execution: %f seconds \n", (double)(endClose-startClose)/CLOCKS_PER_SEC );

    theLayer=NULL;
    layerInfo=NULL;
    }

    endOverall = clock();
    printf("Time required for all execution: %f seconds \n", (double)(endOverall-startOverall)/CLOCKS_PER_SEC );
    }

    What I was trying to do was to free resources for non raster data before throwing an error message for the user to be able to reload any other project and not to have blue or red maps because the layer was not closed before new map loading.
    Is there a faster solution for closing non raster layers? Because 2.5 minutes for closing the layer is a bit long.

    Thank you,
    Dana
  • dana5dana
    dana5dana Global Mapper User Trusted User
    edited April 2012
    Dana,

    For the .las files, use GM_LoadLayerListEx and pass in a string for aExtraLoadOptions that contains the same value as the LOAD_FLAGS parameter for the IMPORT command for a LAS file from a .gmw file that you save from Global Mapper after setting up the options that you want.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com

    Hello again,
    Thank you for your answer.

    I tried as you said and I wrote

    theError = GM_LoadLayerListEx(mapFileName, &theLayerHandleList, &theNumLayersLoaded, GM_LoadFlags_HideProgress,
    "LOAD_FLAGS=\"7,0.000,0\"");

    But the problem is that the window is prompted to me even if i give him the options. The 7,0.000,0 is copied from gmw file exported after selecting my options.
    Am I doing something wrong? Is there something missing?

    Thank you,
    Dana
  • global_mapper
    global_mapper Administrator
    edited April 2012
    Dana,

    Is the long close time in Debug or Release mode? The particular operations that the GM_CloseLayer operation is doing are extremely slow for the debug Windows libraries, but much faster in Release mode.

    For the extra flags, just pass in "7,0.000,0", don't include the "LOAD_FLAGS=" part.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • dana5dana
    dana5dana Global Mapper User Trusted User
    edited April 2012
    Dana,

    Is the long close time in Debug or Release mode? The particular operations that the GM_CloseLayer operation is doing are extremely slow for the debug Windows libraries, but much faster in Release mode.

    For the extra flags, just pass in "7,0.000,0", don't include the "LOAD_FLAGS=" part.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com

    Hello Mike,
    Thank you for the prompt answers.
    For the "7,0.000,0" I tried now and it works. Thank you very much.
    For the long close time the clock times I prompted earlier, they are in debug mode, but in release mode I tested right now and for non raster I still have a long time for Gm_closeLayer function

    non raster results release mode.png

    Thank you,
    Dana
  • global_mapper
    global_mapper Administrator
    edited April 2012
    Dana,

    That is very strange. I just loaded a 900 MB .las file (had to use 64-bit mode as it had 36 million points and was too large for 32-bit version) and the GM_CloseLayer call on it too just over 3 seconds, both in the SDK and the GM application. What version of the SDK are you using and how large is your .las file? If you load it in the GM application, how long does it take to close the layer there? You should get basically the same performance between both for closing a layer.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • dana5dana
    dana5dana Global Mapper User Trusted User
    edited April 2012
    Dana,

    That is very strange. I just loaded a 900 MB .las file (had to use 64-bit mode as it had 36 million points and was too large for 32-bit version) and the GM_CloseLayer call on it too just over 3 seconds, both in the SDK and the GM application. What version of the SDK are you using and how large is your .las file? If you load it in the GM application, how long does it take to close the layer there? You should get basically the same performance between both for closing a layer.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com

    Hello,
    Thank you very much for the answer. I tested also in the sample application and closing takes very long also (when the selected load option is not elevation grid).

    But I solved that problem with the solution you gave me for GM_LoadLayerListEx , and the large amount of closing time is avoided because the user will not have the opportunity to choose whether it will be an elevation grid or not what he is loading, it will be directly an elevation grid. In this case the elevation grid closing works very fast so the problem is solved for me now.

    Thank you very much for your answers, they were very prompt and useful.
    Dana
  • global_mapper
    global_mapper Administrator
    edited April 2012
    Dana,

    Ok, that is a work around, although I'm still not sure why it would be slow for you. Even with the point cloud option from a much larger LAS file than you are using it closes very fast for me, both with the SDK and the Global Mapper application.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com