mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-23 15:51:24 +00:00
use steps for waypoints in routing service
This commit is contained in:
@@ -62,16 +62,21 @@ func (o *OSRM) Route(ctx context.Context, req *pb.RouteRequest, rsp *pb.RouteRes
|
|||||||
return errors.InternalServerError("routing.route", "failed to get route: %v", err.Error())
|
return errors.InternalServerError("routing.route", "failed to get route: %v", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, waypoint := range resp.Waypoints {
|
for _, routes := range resp.Routes {
|
||||||
|
for _, leg := range routes.Legs {
|
||||||
|
for _, step := range leg.Steps {
|
||||||
|
for _, intersect := range step.Intersections {
|
||||||
rsp.Waypoints = append(rsp.Waypoints, &pb.Waypoint{
|
rsp.Waypoints = append(rsp.Waypoints, &pb.Waypoint{
|
||||||
Name: waypoint.Name,
|
Name: step.Name,
|
||||||
Distance: float64(waypoint.Distance),
|
|
||||||
Location: &pb.Point{
|
Location: &pb.Point{
|
||||||
Latitude: waypoint.Location.Lat(),
|
Latitude: intersect.Location.Lat(),
|
||||||
Longitude: waypoint.Location.Lng(),
|
Longitude: intersect.Location.Lng(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user