code: def gps_bearing(lat1, lon1, lat2, lon2):
      '''return bearing between two points in degrees, in range 0-360
      thanks to http://www.movable-type.co.uk/scripts/latlong.html'''
      lat1 = math.radians(lat1)
      lat2 = math.radians(lat2)
      lon1 = math.radians(lon1)
      lon2 = math.radians(lon2)
      dLat = lat2 - lat1
      dLon = lon2 - lon1
      y = math.sin(dLon) * math.cos(lat2)
      x = math.cos(lat1)*math.sin(lat2) - math.sin(lat1)*math.cos(lat2)*math.cos(dLon)
      bearing = math.degrees(math.atan2(y, x))
      if bearing < 0:
          bearing += 360.0
      return bearinf gps_bearing(lat1, lon1, lat2, lon2):
      '''return bearing between two points in degrees, in range 0-360
      thanks to http://www.movable-type.co.uk/scripts/latlong.html'''
      lat1 = math.radians(lat1)
      lat2 = math.radians(lat2)
      lon1 = math.radians(lon1)
      lon2 = math.radians(lon2)
      dLat = lat2 - lat1
      dLon = lon2 - lon1
      y = math.sin(dLon) * math.cos(lat2)
      x = math.cos(lat1)*math.sin(lat2) - math.sin(lat1)*math.cos(lat2)*math.cos(dLon)
      bearing = math.degrees(math.atan2(y, x))
      if bearing < 0:
          bearing += 360.0
      return bearing
docs: return bearing between two points in degrees, in range 0-360
      thanks to http://www.movable-type.co.uk/scripts/latlong.html