Global Mapper Pro

Convergence angle between true and grid North

rick_edwards
rick_edwards Global Mapper User
edited September 2010 in SDK
Hi all,

is it possible given a point in a projection to get the convergence angle and sign between true North and grid North through the SDK? Global mapper application can distinguish between true and grid North through the "Distance/Bearing/COGO Line" option but I need to get a convergence angle value programatically for an individual point for use in a calculation.

Any advice?

Thanks

Rick

Comments

  • global_mapper
    global_mapper Administrator
    edited August 2010
    Rick,

    Would an enhanced GM_CalcBearing function work, one that allowed you to specify whether you want the bearing relative to magnetic north, grid north, or true north?

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • rick_edwards
    rick_edwards Global Mapper User
    edited August 2010
    Having had a think about this it would be useful to correct a bearing for true north, the approach would be effectively the same for us as getting the convergence angle at a point and adjusting our azimuth, the two provide the same effect. I'm guessing GM_CalcBearing doesn't already support this?

    Also we would probably need to call this function in parallel so is it thread safe?

    Thanks for your help.

    Rick
  • global_mapper
    global_mapper Administrator
    edited August 2010
    Rick,

    I have updated the GM_CalcBearing function to support using a particular bearing sense (the existing 8-bit boolean parameter was updated to an 8-bit flag). I have placed a new SDK build with this change at http://www.globalmapper.com/GlobalMapperSDK_v134_beta.zip for you to try.

    In general this call should be thread-safe, except if you are changing the current projection in the middle of the call.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • rick_edwards
    rick_edwards Global Mapper User
    edited September 2010
    Hi Mike,

    sorry for the delay in getting back to you, have been running some tests with the new SDK. All looks ok though when we call the new GM_CalcBearing method though a DllImport call from our managed code it's really slow. Unfortunately, our calculations run over many hundreds of thousands of points and the performance hit is huge.

    Now I've tweaked the test SDK application to test running this number of calls to the calc bearing method directly and it'll handle a million calls in about 7 seconds (this is all rough figures) whereas through our application the calculation takes 2-3 minutes (compared to 20 seconds when we don't do the correction). The rate determining step is the call to the unmanaged dll but the input parameters are simple with no complex marshalling involved:
            [DllImport(DLLFileName), SuppressUnmanagedCodeSecurity]
            internal static extern GM_Error_t32 GM_CalcBearing
            (
                double aFromX,
                double aFromY,
                double aToX,
                double aToY,
                GM_BearingFlags_t8 aFlags,
                out double aBearing
            );
    

    Now in the test SDK application I'm simply importing our demo digital terrain file and setting the projection before running the calc bearing test on a single point a million times. Is there any other factors in our real application that might significantly reduce the calculation time that I'm not setting in the test SDK application? It might be that interop simply isn't up to this job.

    Any advice?

    Regards

    Rick
  • global_mapper
    global_mapper Administrator
    edited September 2010
    Rick,

    When you're passing you your points, are they already lat/lon points or are you passing in points in some projection? I'm just wondering if the reprojection to lat/lon might be causing the slowdown if you are passing in projected coordinates.

    If not, it could very well be the interop. I wonder if you could maybe write your own unmanaged function that takes a big list of points, then does the calculating, then returns the entire results back, so you only have one interop call.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • rick_edwards
    rick_edwards Global Mapper User
    edited September 2010
    Hi Mike,

    we pass in coordinates as projection coordinates not as lat/long values. However, following some discussion here at my end it would appear that I don't actually need to correct for each measurement point (theoretically I should but it's complete overkill apparently!). I'll look into reducing the number of corrections we need to do and get back to you if there's still an issue.

    Thanks.

    Rick
Sign In or Register to comment.