I have location values for every driving trip fetched from our servers. I need to generate a single route that is matched to roads, with given locations. I’m using Leaflet Javascript Map Library, OpenStreetMap Tile Map Service and OSRM API Match Service.
I send 100 (parameter limit) locations(latitudes and longitudes) per request, then I append a list with every geometry returned as a response from OSRM Match API. Then I decode every single geometry, result is a list of lats and longs. I combine the result then draw it on a map.
P.S. Time interval between consecutive locations is 1 second.
Some of the locations are well matched to roads as exactly I want.
But most of the trip is shown on the map with a lot of branching, unrelated lines;
There are even unmatched, recurring shapes;
Here is the explanation of Match Service which is found in official OSRM documentation;
Is there a way to generate a single, properly drawn line that’s matched to roads, using these services?