Hi Steve,

I think I found a very old bug in mkgmap, it seems to exist since at least r2210.
I found it while testing a patch for r2914 and found it in all older versions that I tried.

Attached are two test files and a gdb for MapSource.
The command that I use:
java -jar d:\mkgmap\dist\mkgmap_r2889.jar --link-pois-to-ways --route --nsis --tdbfile --preserve-element-order  f:\osm\good.osm
or
java -jar d:\mkgmap\dist\mkgmap_r2889.jar --link-pois-to-ways --route --nsis --tdbfile --preserve-element-order  f:\osm\bad.osm

The only difference in the two files is the order of the ways w3 and w4 (the ids don't seem to matter)

I use r2889 to test this because current trunk version uses a sort in the RoadMerger, but the error is not related to the merge.
With bad.osm MapSource calculates a route that that passes the target point, goes up to the barrier and then reverses back to the target.
This happens with vehicles like car and bike and seems not to be related to any routing preferences.

I hope you can reproduce the problem and find out what goes wrong...

Gerd