|
@@ -141,11 +141,13 @@ func (s *AMapService) Request(ctx context.Context, request *v1.PostLocationReque
|
|
|
if err != nil {
|
|
|
return nil, eris.Wrapf(err, "error select by previous")
|
|
|
} else {
|
|
|
- // 无效的点位
|
|
|
- if isInvalidPosition := previousPositionDiff(prevMapLocation, result.Result.Location, request.PositionTime); isInvalidPosition {
|
|
|
- log.Warn().Str("prev", prevMapLocation.Location).Str("now", result.Result.Location).
|
|
|
- Msgf("定位命中距离算法判断, 丢弃点位")
|
|
|
- return nil, v1.ErrLocationInvalid
|
|
|
+ if prevMapLocation != nil {
|
|
|
+ // 无效的点位
|
|
|
+ if isInvalidPosition := previousPositionDiff(prevMapLocation, result.Result.Location, request.PositionTime); isInvalidPosition {
|
|
|
+ log.Warn().Str("prev", prevMapLocation.Location).Str("now", result.Result.Location).
|
|
|
+ Msgf("定位命中距离算法判断, 丢弃点位")
|
|
|
+ return nil, v1.ErrLocationInvalid
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|