• API
• FAQ
• Tools
• Archive
daily pastebin goal
17%
SHARE
TWEET

# Untitled

a guest Mar 19th, 2019 40 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. def haversine(lon1, lat1, lon2, lat2):
2.     """
3.     Calculate the great circle distance between two points
4.     on earth (specified in decimal degrees)
5.     """
6.     # convert decimal degrees to radians
11.     # haversine formula
12.     dlon = lon2 - lon1
13.     dlat = lat2 - lat1
14.     a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2
15.     c = 2 * asin(sqrt(a))
16.     r = 6371 # Radius of earth in kilometers. Use 3956 for miles
17.     distance_btwn_points= c * r
18.     return distance_btwn_points
19.
20. radius = 2.00 # in kilometer
23. for port in ports_location['port_id']:
24.     for index, row in ship_navigation_port.iterrows():
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top