This commit is contained in:
gazebo
2019-11-27 17:59:28 +08:00
parent d6e172f6f9
commit d6205e955d

View File

@@ -210,6 +210,9 @@ func EarthDistance(lng1, lat1, lng2, lat2 float64) float64 {
lng2 = lng2 * rad
theta := lng2 - lng1
dist := math.Acos(math.Sin(lat1)*math.Sin(lat2) + math.Cos(lat1)*math.Cos(lat2)*math.Cos(theta))
if dist < 0 {
dist = 0
}
return dist * radius
}