A single leg for multiple waypoints

Dear friends I’m working on a Android applicazione and I’m trying to calculate the best route using from 10 to 15 points.

In this way i’m using each points like waypoints and then the response is composed from multiple legs and the my instructions are worng.

I would like to pass all points in request but i need to use only the first and the last point like wayPoint this will allow me to get a single leg with correct instruction

My request actually is the following:

GHRequest req = new GHRequest().setAlgorithm(Parameters.Algorithms.DIJKSTRA_BI);
req.setProfile("car");
LatLng ll;
for (int i = 0; i < waypointList.size(); i++) {
        ll = waypointList.get(i);
        req.addPoint(new GHPoint(ll.getLatitude(), ll.getLongitude()));
 }
List<Double> head = new ArrayList<>();
head.add(dir);
req.getHints().put("ch.disable","true");
req.setHeadings(head);
req.getHints().put("instructions", "true");
GHResponse resp = hopper.route(req);

Can you give me some suggestion about this?

I don’t understand your question. So you send a request with multiple points. But what is your question?

I try to explain the problem more in details:

1

In this example I’m trying to request a path from P1 to P6, but when I get InstructionList from my response

resp.getBest().getInstructions()

I found this:

WAYPOINT_REACHED on P2
WAYPOINT_REACHED on P3
WAYPOINT_REACHED on P4
WAYPOINT_REACHED on P5

seems that each point is considered like a waypoints, instead I wants to use only P1 and P6 like waypoints.

I see. You want to force the route to visit P2,3,4,5 but they should not be included in the instructions? Can you not simply filter the instruction list and remove those waypoint_reached instructions? If that doesn’t work you need to change the server-side code accordingly. There is no configuration option that does this.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.