Ricky's profileRicky's Bing Maps BlogBlogSkyDrive Tools Help

Blog


    10/14/2008

    Calculate destination coordinate

    Theory

    Sometimes it’s useful to be able to calculate the coordinates of a destination based off a point of origin, a bearing (β) and a distance. One popular activity that uses this is orienteering. Orienteering is a competition which is a timed race where participants use a map, and a compass to navigate between check points. At each check point the participant will receive the bearing and distance to the next check point based on the current location of the check point. The distance that is used is the arc length (L) between the two points. Knowing this we can derive the central angle (δ) between the two points based at the center of the Earth.

    clip_image002

    Using the central angle and trigonometry we can calculate the latitude of the destination point using the following formula:

    clip_image004

    Now that we know the latitude of the destination point we can calculate the longitude by using the following formula:

    clip_image006

    Application

    The function to calculate the destination coordinate will take in three parameters; a point of origin, a bearing, and a distance. With these parameters we can calculate the latitude and longitude coordinates of the destination point. This function returns a VELatLong object.

    var earthRadius = 6367; //radius in km
    function calculateCoord(origin, brng, arcLength)
    {
    var lat1 = DegtoRad(origin.Latitude);
    var lon1 = DegtoRad(origin.Longitude);
    var centralAngle = arcLength /earthRadius;

    var lat2 = Math.asin( Math.sin(lat1)*Math.cos(centralAngle) + Math.cos(lat1)*Math.sin(centralAngle)*
    Math.cos(DegtoRad(brng)));
    var lon2 = lon1+ Math.atan2(Math.sin(DegToRad(brng))*Math.sin(centralAngle)*Math.cos(lat1),
    Math.cos(centralAngle)-Math.sin(lat1)*Math.sin(lat2));

    return new VELatLong(RadtoDeg(lat2),RadtoDeg(lon2));
    }

    Listing 1 Function to calculate a destination coordinate

    The following post has additional information on the RadToDeg and DegToRad methods: http://rbrundritt.spaces.live.com/blog/cns!E7DBA9A4BFD458C5!257.entry

    Comments

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.
    Ricky Brundritt has turned off comments on this page.

    Trackbacks

    The trackback URL for this entry is:
    http://rbrundritt.spaces.live.com/blog/cns!E7DBA9A4BFD458C5!400.trak
    Weblogs that reference this entry
    • None