Global Mapper v24.1

GM_CalcAreaElevStats

dana5dana
dana5dana Global Mapper UserTrusted User
edited December 2013 in SDK
Hello,

I try to find statistics for an area, what I try mainly is to find the min and max elevations within the area.

This is ho I tried to do it:

GM_AreaElevStats_t* elevStats = NULL;
_theError = GM_CalcAreaElevStats(_theLayerHandleList, 0, elevStats, gmAreaPoints, areaPoints.size(), 0.0, 0.0, NULL);


The problem is that it gives me an gm_error code 2, which means invalid paramater.

I have tried also the simple layer instead of the layer list and also I have tried that the points that are in the area be in native projection and in another try they were in geographic projection. I keep getting error 2 invalid parameter and I don't know what is not right in the parameters list.

Thank you,
Dana

Comments

  • global_mapper
    global_mapper Administrator
    edited December 2013
    Dana,

    You are passing in the statistics buffer incorrectly. You need to allocate it on the stack (or somewhere) and pass in the address of it. You are just passing in a NULL pointer now. Try the following:

    GM_AreaElevStats_t elevStats;
    memset( &elevStats, 0, sizeof elevStats );
    _theError = GM_CalcAreaElevStat( NULL, 0, &elevStats, gmAreaPoints, areaPoints.size(), 0.0, 0.0, NULL);

    I would also be interested in what the gmAreaPoints and areaPoints refer to, but I'll assume those are ok for now.

    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