mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-11 19:04:35 +00:00
use steps for waypoints in routing service
This commit is contained in:
@@ -62,15 +62,20 @@ 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())
|
||||
}
|
||||
|
||||
for _, waypoint := range resp.Waypoints {
|
||||
rsp.Waypoints = append(rsp.Waypoints, &pb.Waypoint{
|
||||
Name: waypoint.Name,
|
||||
Distance: float64(waypoint.Distance),
|
||||
Location: &pb.Point{
|
||||
Latitude: waypoint.Location.Lat(),
|
||||
Longitude: waypoint.Location.Lng(),
|
||||
},
|
||||
})
|
||||
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{
|
||||
Name: step.Name,
|
||||
Location: &pb.Point{
|
||||
Latitude: intersect.Location.Lat(),
|
||||
Longitude: intersect.Location.Lng(),
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user