1<script src="https://maps.googleapis.com/maps/api/js?v=3&sensor=false&libraries=geometry"></script>
2
3var point1 = new google.maps.LatLng(lat1, lng1);
4var point2 = new google.maps.LatLng(lat2, lng2);
5var heading = google.maps.geometry.spherical.computeHeading(point1,point2);
6