I’m using Route Optimization API in my project, and I would like to know how to access in someway the points ordered after optimization. What I need is to get the lat,lon couple of the points that I have added to the request, ordered according to the optimization, 'cause I want to show them on the map with a popup marked with the order number they “received”.
I’ve read this part of documentation looking for a useful output parameter and, apart from paths[0].points_order
that gives me the new order of points, I couldn’t manage to find anything else, or how to use parameters. I’ve only found paths[0].points
and paths[0].snapped_waypoints
that could be the ones to give me the ordered infos, but I’m not sure which one I should use and how. I’ve tried setting points_encoded
to false
in the request, since in the docs they say:
If points_encoded=true or no points_encoded specified an encoded string will be returned, otherwise an array with order [lon,lat,elevation] is returned.
But I don’t know how to access this information to achieve what I want, and which between points or snapped_waypoints I should use
EDIT:
I’v tried this query:
https://graphhopper.com/api/1/route?point=44.1388386%2C12.243707&point=44.1374648%2C12.2480796&point=44.1359114%2C12.2454082&point=44.1371501&2C12.24147&vehicle=foot&locale=de&points_encoded=false&key=[my_key]
In the result I have a lot of lat,lon couple inside the “points” array, and just 3 out of 4 points specified in snapped_waypoints, that aren’t even the points I’ve specified. What do these results represent? Apparently I can’t use them to achieve my objective.
Also, if using the ghRouting request in javascript code, points_encoded is still considered to be true even if I set it to false