1
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"crypto/md5"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/autonavi"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"math/rand"
|
||||
@@ -16,7 +17,6 @@ import (
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/autonavi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/baseapi/utils/routinepool"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/excel"
|
||||
@@ -230,6 +230,23 @@ func GetUniversalOrderIDFromOrderStatus(status *model.OrderStatus) string {
|
||||
return ComposeUniversalOrderID(status.VendorOrderID, status.VendorID)
|
||||
}
|
||||
|
||||
// BaiDuCoord2Gaode2 将百度坐标转换为高德坐标
|
||||
func BaiDuCoord2Gaode2(baiduCoordinat []string) []string {
|
||||
gaoCoordinat := make([]string, 0, 0)
|
||||
for _, v := range baiduCoordinat {
|
||||
var XPI = math.Pi * 3000.0 / 180.0
|
||||
coords := strings.Split(v, ",")
|
||||
var x = utils.Str2Float64(coords[0]) - 0.0065
|
||||
var y = utils.Str2Float64(coords[1]) - 0.006
|
||||
var z = math.Sqrt(x*x+y*y) - 0.00002*math.Sin(y*XPI)
|
||||
var theta = math.Atan2(y, x) - 0.000003*math.Cos(x*XPI)
|
||||
var gg_lng = z * math.Cos(theta)
|
||||
var gg_lat = z * math.Sin(theta)
|
||||
gaoCoordinat = append(gaoCoordinat, fmt.Sprintf("%.6f,%.6f", gg_lng, gg_lat))
|
||||
}
|
||||
return gaoCoordinat
|
||||
}
|
||||
|
||||
// distance单位为米
|
||||
func ConvertDistanceToLogLat(lng, lat, distance, angle float64) (newLng, newLat float64) {
|
||||
oneDu := 111319.55 // 单位为米
|
||||
@@ -364,18 +381,6 @@ func MapValue2Scope(value, fromMin, fromMax, toMin, toMax int64) int64 {
|
||||
return int64(math.Round(float64(value-fromMin)/float64(fromMax-fromMin)*float64(toMax-toMin) + float64(toMin)))
|
||||
}
|
||||
|
||||
func Errs2Str(sep string, errs ...error) (retVal string) {
|
||||
if sep == "" {
|
||||
sep = "\n"
|
||||
}
|
||||
for _, err := range errs {
|
||||
if err != nil {
|
||||
retVal += err.Error() + sep
|
||||
}
|
||||
}
|
||||
return retVal
|
||||
}
|
||||
|
||||
func IntWeight2Float(weight int) float32 {
|
||||
return float32(weight) / 1000.0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user