distanceInNm method
Haversine formula. Giving great-circle distances between two points on a sphere from their longitudes and latitudes. It is a special case of a more general formula in spherical trigonometry, the law of haversines, relating the sides and angles of spherical "triangles".
startPoint
Initial coordinates
endPoint
Final coordinates
Returns distance in nautical miles
final istCoordinates = Coordinate(41.28111111, 28.75333333); // The coordinates of Istanbul Airport
final jfkCoordinates = Coordinate(40.63980103, -73.77890015); // The coordinates of New York JFK Airport
final greatCircle = GreatCircle();
final distance = greatCircle.distanceInNm(istCoordinates, jfkCoordinates);
Implementation
double distanceInNm(Coordinate startPoint, Coordinate endPoint) {
return distance(startPoint, endPoint) * kmToNm;
}