use steps for waypoints in routing service

This commit is contained in:
Asim Aslam
2021-04-26 15:06:04 +01:00
parent d119807d1c
commit 334336ca6f

View File

@@ -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()) return errors.InternalServerError("routing.route", "failed to get route: %v", err.Error())
} }
for _, waypoint := range resp.Waypoints { for _, routes := range resp.Routes {
rsp.Waypoints = append(rsp.Waypoints, &pb.Waypoint{ for _, leg := range routes.Legs {
Name: waypoint.Name, for _, step := range leg.Steps {
Distance: float64(waypoint.Distance), for _, intersect := range step.Intersections {
Location: &pb.Point{ rsp.Waypoints = append(rsp.Waypoints, &pb.Waypoint{
Latitude: waypoint.Location.Lat(), Name: step.Name,
Longitude: waypoint.Location.Lng(), Location: &pb.Point{
}, Latitude: intersect.Location.Lat(),
}) Longitude: intersect.Location.Lng(),
},
})
}
}
}
} }
return nil return nil