title: Maps API v3: Calculate bearing
body: <p>I've been struggling with this for a while &amp; need some advice. I have seen some similar topics but can't find an answer that works for me.</p>
  
  <p>I am creating an app using google maps API that will determine your location, determine a specific point (point b) and then move an arrow to point in the direction of point b. I am having trouble calculating the bearing, could anyone offer some assistance?</p>
  
  <p>I have:
  - the lat/lng of point a
  - the lat/lng of point b
  - the device knows where North is and I am able to calculate how many degrees away from north the device is pointing</p>
  
  <p>I need:
  a calculation that will take this information and spit out a number of degrees to point the arrow.</p>
  
  <p>I have looked here which seems useful but I still can't get it working - it's returning NaN</p>
  
  <p><a href="http://www.movable-type.co.uk/scripts/latlong.html" rel="noreferrer">http://www.movable-type.co.uk/scripts/latlong.html</a></p>
  
  <p>I'm not really a js pro so would really appreciate some guidance here.</p>
  
  <p>Thanks very much!</p>