#Determine distance from latitude and longitude #The first two arguments are the latitude and #longitude of the first point, in degrees. #The next two are the latitude and longitude of #the second point, also in degrees. The return #value is the distance, in miles, between the two #points. def greatCircleDistance(lat1,long1,lat2,long2): #the radius of the earth, in miles: r=3959 #convert from degrees to radians: convert=0.017453292519943295 lat1=convert*lat1 lat2=convert*lat2 long1=convert*long1 long2=convert*long2 #dlat=lat2-lat1 dlong=long2-long1 a=sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(long2-long1) return r*acos(a)