osmandapp/Osmand — pull request #534 by jasalamanca (2013-10-14 21:34:25+00:00)
Title: Issue1384

Hi,

Looking for a solution to issue 1384 I found that origin of incorrect directions becomes from using 2 versions of the same map route segment (not zigzag OSM points as you suggested). One side original map segment and other side new segment added as start, end or intermediate points on route. New segment has a new point added (then some points have a different index here than in original). This mix produce bizarre results on routing algorithm. I saw that when some times routes don't start or end at projection inserted points. This information propagates to directions producing incorrect ones.
The key is to exclude road segment based only on RouteDataObject.id, then RouteContext.loadRouteSegment (and other similar methods) can avoid to use old segment copy.
Problem remains if 2 or more of that new projection points are on same segment of map because no exclusion implemented over segments in RouteCntext.tileRoutes. A future patch.
I tested scenarios from issues 1384 and 1665. Seem solved. I tested old and precise routing algoritms but not native library.

I expect you can review this patch and apply it. Whatever you need let me know.

Javier