Global Mapper v26.0

Invalid Layer error for GM_ExportElevation

dcoggin
dcoggin Global Mapper UserTrusted User
edited October 2012 in SDK
Mike,

I'm having a problem using an older command line code which uses the SDK to output some elevation grids to match an input polygon shapefile. I've used this code for a while and it has worked fine, but I have not used it in the last year until now. The program reads in elevation layers (my current test case has it reading four FLOATGRID layers) and a single polygon shapefile. When I call GM_ExportElevation I get error number 1, GM_ErrorInvalidLayer returned. It works fine if in place of NULL for the layer list I give it any of the four terrain layers. I have checked the GM_LayerInfo for all of the terrain layers and the vector layer immediately before the call and the layer info for all looks good.

I'm not sure if it has anything to do with it, but this is the first time I've used it since the SDK changeover in the winter-spring of this year. The program is currently working with the Aug 9, 2012 build of the 13.13 version. I would appreciate any help or at least knowing why the InvalidLayer error is returned.

Thanks,
David

Comments

  • global_mapper
    global_mapper Administrator
    edited October 2012
    David,

    What language are you calling the SDK from? Are you using GM_ExportElevation (which takes a single layer) or GM_ExportElevationEx which allows you to pass in a list of layers?

    Thanks,

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

    I'm using C++ and calling the regular GM_ExportElevation function but using NULL for the layer. My documentation says (and it has been working) that using NULL in place of the layer handle allows you to export from all layers. Is that not the way it works now?

    Thanks for your help.

    David
  • global_mapper
    global_mapper Administrator
    edited October 2012
    David,

    That's how it's supposed to work but I took a look and found a bug with the call if you provide NULL (internally it just calls GM_ExportElevationEx and that call was wrong). Try instead calling GM_ExportElevationEx and pass in NULL there with 0 for the layer count and NULL for the extra flags and that should work.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • dcoggin
    dcoggin Global Mapper User Trusted User
    edited October 2012
    Thanks, Mike. Using GM_ExportElevationEx works fine.

    David