Last active
December 1, 2017 14:13
-
-
Save yuba/eb7a84fe9bc3fcd4d52b32a45f0e7b89 to your computer and use it in GitHub Desktop.
地球を真球と仮定して2地点間の距離を算出する ref: https://qiita.com/yuba/items/4372944ce0f6a0bf6cb5
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
distance_km = 6371 * acos( | |
cos(latA/180*pi) * cos((lonB - lonA)/180*pi) * cos(latB/180*pi) + | |
sin(latA/180*pi) * sin(latB/180*pi) | |
); |
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
distance_km = 6371 * acos( | |
cos(lonA/180*pi) * cos(latA/180*pi) * cos(lonB/180*pi) * cos(latB/180*pi) + | |
sin(lonA/180*pi) * cos(latA/180*pi) * sin(lonB/180*pi) * cos(latB/180*pi) + | |
sin(latA/180*pi) * sin(latB/180*pi) | |
); |
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
distance_km = 6371 * acos( | |
cos(latA/180*pi) * cos((lonB - lonA)/180*pi) * cos(latB/180*pi) + | |
sin(latA/180*pi) * sin(latB/180*pi) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment