-
-
Save sbis04/26e6faa8d703fcefc704fad4d2eba492 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math' show cos, sqrt, asin; | |
double _coordinateDistance(lat1, lon1, lat2, lon2) { | |
var p = 0.017453292519943295; | |
var c = cos; | |
var a = 0.5 - | |
c((lat2 - lat1) * p) / 2 + | |
c(lat1 * p) * c(lat2 * p) * (1 - c((lon2 - lon1) * p)) / 2; | |
return 12742 * asin(sqrt(a)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment