Global Mapper v25.0

GM_GetPathProfileLOSEx() behavior?

jkenneally
jkenneally Global Mapper UserTrusted User
edited July 2011 in SDK
Hello,

I've run into an issue with GM_GetPathProfileLOSEx returning unexpected terrain intercepts in some cases. I'm hoping I can get some insight into why I am seeing these seemingly strange results. Here is the situation:

I start by loading an elevation tile into global mapper that covers my entire area of interest for my test. Through code, I run two separate GM_GetPathProfileLOSEx() calls. They both start from the same location and altitude (expressed as absolute height above sea level). Both 'lines' that I am profiling are heading in the exact same direction from the point of origin. One line is being cast to a geographic point on the horizon at altitude 0, the other line is being cast to a point somewhere in between the origin and the horizon point, also at altitude 0.

As far as I can tell, in this situation the distance from my origin point to the mLOSFirstBlockedPos member of the returned GM_PathProfileLOSParams_t for the 'line to horizon' should always be at least >= the distance from origin to mLOSFirstBlockedPos of the point in between origin and horizon, given that they are following the same direction.

However, I am seeing many cases where somehow the line towards the horizon is indicating it is intercepting terrain closer to the origin point than the line to the point in-between origin and horizon.

In fact, sometimes it seems that if I repeatedly call GM_GetPathProfileLOSEx() shifting the only the target point slightly towards the horizon each time in a constant direction, the mLOSFirstBlockedPos shifts towards the point of origin as it moves.

Can you shed some light on how or why this would be happening?

Comments

  • global_mapper
    global_mapper Administrator
    edited July 2011
    This could be happening due to how the path is being sampled. The number of elevations that are checked along the path is configurable by providing a point count for the path profile. If the shorter line is using the same number of points as the longer path, it will be sampled more frequently and might find a small spike of elevation that the less thoroughly sampled longer path didn't see. You might want to set the point count as a fixed distance (based on length of path and number of points asked to sample at) rather than just using some fixed point count, that way you should get consistent results.

    Also is your altitude of zero relative to the ground or an absolute elevation? If it is relative to the ground then you could certainly get different results as for the short distance it might be on the back-side of a hill whereas at the long distance it could be high up on a facing mountain.

    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 July 2011
    Hi Mike,

    I thought those might be the problem as well during initial testing. I double checked the absolute height issue. We are specifying 'GM_PathProfile_LOSFromHeightAbsolute' as our heights, and both end heights are set to 0.

    As for the point count, you are correct that we are currently passing a constant sample count regardless of the line length, which I will likely correct as you suggested at some point in time. However, the really strange thing about the result is that it is the longer line that is striking terrain first (ie the one going to the horizon). It doesn't seem to matter how high I make the sample count for the shorter line..it never seems to intercept terrain as early as the other. This is particularly odd as it seems that the line going towards the horizon should be 'above' the other line at any given point along the profile...

    Any other thoughts?

    Thanks
  • global_mapper
    global_mapper Administrator
    edited July 2011
    Actually unless you are ignoring earth curvature I would expect the longer line to hit first since due to the curvature of the earth the path will be actually lower compared to the earth's surface. You can see that if you just draw a curved represnetation of the surface on paper and then draw the 2 paths.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • jkenneally
    jkenneally Global Mapper User Trusted User
    edited July 2011
    Maybe I am missing something, but from an aerial perspective, I would only picture the longer line being at a 'lower' altitude than the short one at any given sample point if it actually went over the horizon. However, up to the point at horizon shouldn't it always be higher?

    I've attached a simple example image that show's what I'm picturing. As drawn it would represent two LOS rays to MSL from an airborne platform, with the red line extending to the horizon. With DTED in play, the red line is somehow striking terrain earlier than the blue line in some cases.
  • global_mapper
    global_mapper Administrator
    edited July 2011
    You've got the start and end points at the wrong place. The start and end point for the line of sight should be at the edges with the bump in the middle for the earth curvature. Then the longer path can hit the terrain first due to earth curvature as its path would likely go under the path for the shorter line.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • jkenneally
    jkenneally Global Mapper User Trusted User
    edited July 2011
    Hi Mike,

    Why would the start and end points be at the either edge of this diagram? We are looking from an aircraft, and the earth would be closest to said aircraft directly below it. As drawn, the earth would be curving away from the aircraft in all directions. The longer line can only go 'over the bump' if it is going 'over the horizon'.

    The line of site rays are both starting from the aircraft lat/lon/altitude, ending at altitude 0, with identical azimuth. One ray end point is at a lat/lon that has been calculated to be at the visible horizon from the aircraft, the other ray end point is at some position in between the horizon and the aircraft.

    If our horizon calculation is wrong and we are actually casting the horizon ray 'over the horizon', then I agree it would start to fall downward and might strike terrain sooner than the ray being cast closer to the aircraft position.

    My question is whether or not there are any other reasons the GetPathProfileLOS call might be causing the ray being cast to the horizon to intersect sooner than the shorter one? As far as I know we are not casting our rays over the horizon as you seem to be describing.

    Thanks
  • global_mapper
    global_mapper Administrator
    edited July 2011
    The earth can be considered to curve away from both the transmitter and receiver in both directions. Any drawing online of line of sight calculations has the transmitter and receiver at the same curvature location on opposite sides of a bulge in the middle. Your transmitter is still perpendicular to the surface. See http://tscm.com/rdr-hori.pdf for example or http://mathforum.org/library/drmath/view/66747.html. The formulas used to calculate adjustment for earth curvature also work by offsetting the elevations upwards to a maximum at the middle of the path range, with 0 offset at either end. Hopefully this clears things up.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com