Global Mapper v25.0

Using GM_GetPathProfileEx to retrieve elevation at mLOSFirstBlockedPos?

jkenneally
jkenneally Global Mapper UserTrusted User
edited May 2011 in SDK
Hi,

I'm wondering if there is a simple way through the GM_GetPathProfileEx() call to find what the actual terrain elevation is at the point of GM_PathProfileLOSParams_t.mLOSFirstBlockedPos, when a terrain intersection has been indicated by GM_PathProfileLOSParams_t.mLOSMinClearance being < 0?

I wondered if the mElevList member of the struct could return this, but I don't see anything in the docs to indicate the returned samples would be tied to the blocked points in any way. I'm hoping to avoid a separate call to GM_GetLocationElevation() for performance reasons.

Thanks!

Comments

  • global_mapper
    global_mapper Administrator
    edited May 2011
    The elevation value should be in the mElevList structure, but there wouldn't be a particularly easy way to determine which one. The GM_GetLocationElevation call should be pretty fast compared to the GM_GetPathProfileEx call you just made, so I don't think you will even notice any additional overhead just calling that. Should be cleaner.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • jkenneally
    jkenneally Global Mapper User Trusted User
    edited May 2011
    Ok, that was the impression I had from the docs as well. I agree the GM_GetLocationElevation() call will be relatively cheap compared to GM_GetPathProfileEx(), but I am a little more concerned that now I will have to do a secondary search through my source list of 'layers' that were passed to GM_GetPathProfileEx() in order to find the one that is best suited to be passed into GM_GetLocationElevation(). That could could incur a more measurable performance hit than the elevation lookup itself.

    Would you ever consider something like storing the elevation along with the lat/lon in the mLOSFirstBlockedPos/mLOSLastBlockedPos members of GM_PathProfileLOSParams_t?

    Thanks again!
  • global_mapper
    global_mapper Administrator
    edited May 2011
    You can just pass in NULL for the layer handle to the GM_GetLocationElevation function for the layer handle and it will search all loaded terrain layers. This is typically what you would want to do and should be very fast.

    If for some reason this isn't workable let me know and I can probably integrate this right into the GM_PathProfileLOSParams_t structure.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • jkenneally
    jkenneally Global Mapper User Trusted User
    edited May 2011
    Ahh ok, thanks for clarifying the usage of the NULL param. When I read "IN: Layer to get elevation from or NULL for topmost" I assumed it meant it would just use the last loaded dted tile and not do any search.

    As a follow on question to this feature, is the search optimized in any way? So if I have many tiles loaded is it going to just bounds check each of them linearly or is there some kind of spatial indexing/optimized data organization in place to help with this?

    In the case I have described the layer list I will have passed to GM_GetPathProfileEx() will have already been picked out from a much larger loaded list. So in that case it may still be faster for me to pick a layer from that subset instead of having GM search through the entire loaded layer list again?

    Cheers!
  • global_mapper
    global_mapper Administrator
    edited May 2011
    The GM_GetLocationElevation function will just do a reverse search through the loaded terrain layers for the first one with an elevation value at the given location. The bounding boxes will be used to throw out layers that don't cover the point. This should be an extremely fast check, so unless you are calling this millions of times in a small area there isn't too much point in building a pre-optimized list of layers that might intersect.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • jkenneally
    jkenneally Global Mapper User Trusted User
    edited May 2011
    Ok, thanks for your response. I think I can use that approach for now. Hehe if performance turns out to be an issue in our final testing I may come back and plead for the field to be added but hopefully it will be fast enough as is. :p

    Just to summarize, I think there would be merit in making the following changes to the GM_GetPathProfileEx functionality for general use in a future GM SDK release:
    a) Adding elevation of intersect to the mLOSFirstBlockedPos/mLOSLastBlockedPos members of GM_PathProfileLOSParams_t.
    b) Conversely, returning the Lat/Lon of GM_PathProfileLOSParams_t.mLOSMinClearance would also make that field much more useful in our case.

    Thanks!