(pos1, pos2)
| 651 | |
| 652 | |
| 653 | def calc_distance(pos1, pos2): |
| 654 | R = 6378.1 # km radius of the earth |
| 655 | |
| 656 | dLat = math.radians(pos1[0] - pos2[0]) |
| 657 | dLon = math.radians(pos1[1] - pos2[1]) |
| 658 | |
| 659 | a = math.sin(dLat / 2) * math.sin(dLat / 2) + \ |
| 660 | math.cos(math.radians(pos1[0])) * math.cos(math.radians(pos2[0])) * \ |
| 661 | math.sin(dLon / 2) * math.sin(dLon / 2) |
| 662 | |
| 663 | c = 2 * math.atan2(math.sqrt(a), math.sqrt(1 - a)) |
| 664 | d = R * c |
| 665 | |
| 666 | return d |
| 667 | |
| 668 | |
| 669 | # Delay each thread start time so that logins only occur ~1s |
no outgoing calls
no test coverage detected