1
This commit is contained in:
@@ -601,7 +601,7 @@ func GetSToURidingDistance(sLng, sLat, uLng, uLat float64, orderId string) (step
|
|||||||
Lat: uLat,
|
Lat: uLat,
|
||||||
Lng: uLng,
|
Lng: uLng,
|
||||||
})
|
})
|
||||||
if coords, err = api.BaiDuNaviAPI.BatchCoordinateConvert(coords, baidunavi.CoordSysGCJ02, baidunavi.CoordSysBaiDu); err == nil {
|
if coords, err = api.BaiDuNaviAPI.BatchCoordinateConvert(coords, baidunavi.CoordSysGaoDe2Baidu); err == nil {
|
||||||
if len(coords) > 0 {
|
if len(coords) > 0 {
|
||||||
if stepInfo, err = api.BaiDuNaviAPI.DirectionLiteRide(coords); err == nil {
|
if stepInfo, err = api.BaiDuNaviAPI.DirectionLiteRide(coords); err == nil {
|
||||||
return stepInfo, nil
|
return stepInfo, nil
|
||||||
@@ -724,7 +724,8 @@ func GetCyclingLine(sLng, sLat, uLng, uLat float64) (polyLineList []string, dist
|
|||||||
Lng: uLng,
|
Lng: uLng,
|
||||||
})
|
})
|
||||||
|
|
||||||
coords, err = api.BaiDuNaviAPI.BatchCoordinateConvert(coords, baidunavi.CoordSysGCJ02, baidunavi.CoordSysBaiDu)
|
// 高德坐标转换成百度坐标
|
||||||
|
coords, err = api.BaiDuNaviAPI.BatchCoordinateConvert(coords, baidunavi.CoordSysGaoDe2Baidu)
|
||||||
if err != nil || len(coords) <= model.NO {
|
if err != nil || len(coords) <= model.NO {
|
||||||
return nil, 0, 0, err
|
return nil, 0, 0, err
|
||||||
}
|
}
|
||||||
@@ -740,13 +741,31 @@ func GetCyclingLine(sLng, sLat, uLng, uLat float64) (polyLineList []string, dist
|
|||||||
return nil, 0, 0, err
|
return nil, 0, 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
polyLine := make([]string, 0, 0)
|
||||||
if path != nil && len(path.Routes) != 0 {
|
if path != nil && len(path.Routes) != 0 {
|
||||||
distance = int64(path.Routes[0].Distance) // 距离
|
distance = int64(path.Routes[0].Distance) // 距离
|
||||||
duration = int64(path.Routes[0].Duration) // 时间
|
duration = int64(path.Routes[0].Duration) // 时间
|
||||||
|
|
||||||
for _, v := range path.Routes[0].Steps {
|
for _, v := range path.Routes[0].Steps {
|
||||||
polyLineList = append(polyLineList, strings.Split(v.Path, ";")...)
|
polyLine = append(polyLine, strings.Split(v.Path, ";")...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
polyLineList, err = baiDuCoord2Gaode(polyLine)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 美团只认识高德地图坐标点,的转一下
|
||||||
|
func baiDuCoord2Gaode(baiduCoordinat []string) ([]string, error) {
|
||||||
|
coords, err := api.BaiDuNaviAPI.BatchCoordinateConvertBai2Gao(baiduCoordinat, baidunavi.CoordSysBaidu2Gaode)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
gaoCoordinat := make([]string, 0, 0)
|
||||||
|
for _, v := range coords {
|
||||||
|
gaoCoordinat = append(gaoCoordinat, fmt.Sprintf("%.6f,%.6f", v.Lng, v.Lat))
|
||||||
|
}
|
||||||
|
|
||||||
|
return gaoCoordinat, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -699,7 +699,7 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
|||||||
Lat: store.FloatLat,
|
Lat: store.FloatLat,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
coords, err = api.BaiDuNaviAPI.BatchCoordinateConvert(coords, baidunavi.CoordSysGCJ02, baidunavi.CoordSysBaiDu)
|
coords, err = api.BaiDuNaviAPI.BatchCoordinateConvert(coords, baidunavi.CoordSysGaoDe2Baidu)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
for k, v := range batchItemList {
|
for k, v := range batchItemList {
|
||||||
store := v.(*StoreExt)
|
store := v.(*StoreExt)
|
||||||
|
|||||||
Reference in New Issue
Block a user