Get Degrees (0-360) from One LatLng to Another in JavaScript

Posted by Kirk on Stack Overflow See other posts from Stack Overflow or by Kirk
Published on 2010-05-25T22:08:47Z Indexed on 2010/05/25 22:31 UTC
Read the original article Hit count: 134

Can someone help me fill in the blanks with native JavaScript?

function getHeading(lat1, lon1, lat2, lon2) {
    // Do cool things with math here

    return heading; // Should be a number between 0 and 360
}

I've been messing around with this for a long time and can't seem to get my code to work right.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about google-maps