1
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"git.rosy.net.cn/baseapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"go.uber.org/zap"
|
||||
"math"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
@@ -130,3 +131,19 @@ func TestGetOrderLiquidatedDamages(t *testing.T) {
|
||||
t.Log(deductFee)
|
||||
}
|
||||
}
|
||||
func TestChangeCoord(t *testing.T) {
|
||||
lng, lat := GaodeCoord2BaiDu(104.057697, 30.69524)
|
||||
fmt.Println(lng, lat)
|
||||
}
|
||||
|
||||
func GaodeCoord2BaiDu(lng, lat float64) (float64, float64) {
|
||||
x := lng
|
||||
y := lat
|
||||
z := math.Sqrt(x*x+y*y) + 0.00002*math.Sin(y*math.Pi)
|
||||
theta := math.Atan2(y, x) + 0.000003*math.Cos(x*math.Pi)
|
||||
|
||||
bdLng := z*math.Cos(theta) + 0.0065
|
||||
bdLat := z*math.Sin(theta) + 0.006
|
||||
|
||||
return bdLng, bdLat
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user