Last active
January 22, 2020 00:09
-
-
Save diegohordi/06f907987c78663305ab53ae5eed2630 to your computer and use it in GitHub Desktop.
Check radius AWS Lambda
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
... | |
func IsInsideRadius(aLatitude float64, aLongitude float64, bLatitude float64, bLongitude float64, radius int) bool { | |
diffLongitudeRadians := toRadians(bLongitude - aLongitude) | |
aLatitudeRadians := toRadians(aLatitude) | |
bLatitudeRadians := toRadians(bLatitude) | |
difference := math.Acos(math.Sin(aLatitudeRadians)*math.Sin(bLatitudeRadians)+math.Cos(aLatitudeRadians)*math.Cos(bLatitudeRadians)*math.Cos(diffLongitudeRadians)) * slcRadius | |
return difference <= float64(radius) | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment