This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Generate fastest route with set of locations

0

I have a set of locations, the workers need to visit this locations (view below image with points) i need to find the best possible route along this set of points no matter where does it start.

I tried with the "trip/" API but it creates new points that do not exist in the original points, and this creates a terrible route.

Am i missing something in parameters?

http://router.project-osrm.org/trip/v1/driving/-90.499807,38.82392;-90.497916,38.822408;-90.498461,38.822241;-90.496597,38.82351;-90.496352,38.823821;-90.49809,38.825024;-90.495743,38.823304;-90.497415,38.824089;-90.498851,38.823079;-90.49957,38.822156;-90.500771,38.823087;-90.49861,38.82196;-90.496589,38.82255;-90.497906,38.82286;-90.49696,38.822816;-90.49897,38.822577;-90.499736,38.823182;-90.498388,38.823185;-90.498142,38.822603;-90.496481,38.823885;-90.497778,38.824796;-90.497826,38.82337;-90.498705,38.822402;-90.500444,38.822877;-90.497618,38.822596;-90.49804,38.823532;-90.49696,38.822301;-90.499445,38.823499;-90.499071,38.823257;-90.497862,38.823564;-90.496668,38.823013;-90.49884,38.823535;-90.497157,38.822219;-90.49719,38.824389;-90.497107,38.822891;-90.497237,38.822968;-90.499633,38.823079;-90.497061,38.823837;-90.498126,38.823626;-90.497969,38.823923;-90.497473,38.823134;-90.498297,38.825059;-90.499794,38.822598;-90.497592,38.823214;-90.497783,38.82433;-90.498189,38.824087;-90.500557,38.822791;-90.498589,38.82233;-90.498388,38.822737;-90.500666,38.823171;-90.498729,38.823003;-90.497878,38.8249;-90.497381,38.823502;-90.49828,38.8231;-90.497951,38.823454;-90.498483,38.825039;-90.498259,38.822677;-90.499498,38.824195;-90.49817,38.821799;-90.497142,38.823337;-90.498742,38.823433;-90.499237,38.823305;-90.497186,38.823919;-90.499503,38.822995;-90.50002,38.822828;-90.49881,38.822496;-90.500109,38.822332;-90.496935,38.823773;-90.498629,38.822908;-90.500189,38.823052;-90.497524,38.823586;-90.498032,38.822502;-90.499083,38.822658;-90.498594,38.82339;-90.497649,38.824736;-90.49619,38.823234;-90.498351,38.822154;-90.498219,38.822085;-90.499487,38.822238;-90.497439,38.824546;-90.500558,38.823266;-90.498143,38.824573;-90.499182,38.82447;-90.500382,38.822984;-90.496852,38.822382;-90.498783,38.824051;-90.498525,38.823872;-90.496953,38.824221;-90.499716,38.824013;-90.497348,38.822449;-90.499709,38.823049;-90.498075,38.823999;-90.499417,38.822915;-90.500137,38.82364;-90.499989,38.823707;-90.500451,38.823362;-90.499698,38.822076;-90.499604,38.82411;-90.496008,38.823548?steps=true&overview=full

This is the original set of locations alt text

And this is what returns from OSRM, clearly there are additional points, and its wrong alt text

asked 07 Sep '20, 19:06

RonEskinder's gravatar image

RonEskinder
16113
accept rate: 0%

edited 07 Sep '20, 19:54

What are you actually plotting to produce the second view? I swapped the geometry output to geojson and the linestring it produces only shows a path along the expected streets.

(08 Sep '20, 07:14) InsertUser

"geometry": "ww}kFvujgPGGj@{@@o@FMFIHKNUFKNWHMDGb@o@Y@iDlFIKSUQSu@_AIIoA{AKQCYDYNUJMDIHKDIXc@FK@m@HMVa@FKPYLSXc@NUHMh@}@PUHCDAL?LFPVv@zA[f@EDQXOV[d@EHOTILSXCDOVCBINOTMROTOVEFe@r@~GsKJR^t@LVP\\@DNVm@~@EFQVQXOTJMzAaCzAxCDJM@KJGJQVABMRQVOTQXt@fALPPVuAqBQXOTq@dAU\\GLCBJQ^f@FFr@~@{AoBFKGJYd@W@GJCTBTHHNR@@LPPTMQm@u@IKu@_AQUe@k@",

(08 Sep '20, 15:18) RonEskinder

One Answer:

1

The decoder on this page seems to work if you replace the \\'s with \. i.e. using: ww}kFvujgPGGj@{@`@o@FMFIHKNUFKNWHMDGb@o@Y`@iDlFIKSUQSu@_AIIoA{AKQCYDYNUJMDIHKDIXc@FK`@m@HMVa@FKPYLSXc@NUHMh@}@PUHCDAL?LFPVv@zA[f@EDQXOV[d@EHOTILSXCDOVCBINOTMROTOVEFe@r@~GsKJR^t@LVP\@DNVm@~@EFQVQXOTJMzAaCzAxCDJM@KJGJQVABMRQVOTQXt@fALPPVuAqBQXOTq@dAU\GLCBJQ^f@FFr@~@{AoBFKGJYd@W`@GJCTBTHHNR@@LPPTMQm@u@IKu@_AQUe@k@

My guess is that although the documentation page says:

Note that the backslash is interpreted as an escape character within string literals. Any output of this utility should convert backslash characters to double-backslashes within string literals.

The interactive encoder does not seem to (un)do this. Reversing just the first \\ appears to follow the path for longer before the sudden onset of brownian motion.

answered 08 Sep '20, 21:40

InsertUser's gravatar image

InsertUser
11.0k1369185
accept rate: 19%

Source code available on GitHub .