Hi,

attached is a patch that should fix a problem with wrong turn headings when using process-exits or process-destination.

@Gerd, Steve: In RoadNetwork.addRoad link 149+150 a bearing is calculated but the double bearing is converted to int. Why is the double value not rounded? I think this might create problems in some cases?

WanMil

Hi Jonas,

thanks for the test case.
I will have a look on it but it will take some time.

WanMil

Oh, I forgot the link to the minimal test map and .osm extract:

http://brutus.dalom.com/~jetthe/OSM/mkgmap/lkpg_113/

/Jonas


On Mon, Jan 6, 2014 at 10:18 PM, Jonas Tull <[email protected]
<mailto:[email protected]>> wrote:

    Hi!

    I have an issue where a motorway_link which is modified by
    --process-exits gives the wrong turn heading instruction in my GPS
    (NĂ¼vi 205). "Turn left at Exit 113" instead of "Turn right at Exit
113".

    The way is http://www.openstreetmap.org/way/4400960

    When looking at the map in QLandkarte it looks like the first two
    ways created when the _link way is split are almost parallel to the
    motorway. My guess is that it's somehow related to the relatively
    long distance between the first and second node in the original
    _link way.

    I build my maps with the following (relevant?) arguments:
    --adjust-turn-headings --route --housenumbers --process-destination
    --process-exits

    This issue can also be seen in the maps downloaded from
    http://garmin.openstreetmap.nl/

    /Jonas




_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Index: src/uk/me/parabola/mkgmap/reader/osm/LinkDestinationHook.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/LinkDestinationHook.java	(revision 2998)
+++ src/uk/me/parabola/mkgmap/reader/osm/LinkDestinationHook.java	(working copy)
@@ -57,7 +57,7 @@
 	private MultiHashMap<Long, RestrictionRelation> restrictions = new MultiHashMap<>();
 	
 	private List<String> nameTags;
-
+	
 	/** Maps which nodes contains to which ways */ 
 	private IdentityHashMap<Coord, Set<Way>> wayNodes = new IdentityHashMap<Coord, Set<Way>>();
 	
@@ -298,13 +298,14 @@
 					// orientation to the main motorway
 					double oldAngle = getAngle(c1, c2, c);
 					double newAngle = getAngle(c1, c2, cConnection);
-					if (Math.signum(oldAngle) != Math.signum(newAngle)) {
+					if (Math.signum(oldAngle) != Math.signum(newAngle) || ((int)Math.abs(newAngle)) < 2) {
 						double bestAngleDiff = 180.0d;
 						Coord bestCoord = cConnection;
 						for (Coord cNeighbour : getDirectNeighbours(cConnection)) {
 							double neighbourAngle = getAngle(c1, c2, cNeighbour);
 							if (Math.signum(oldAngle) == Math.signum(neighbourAngle) && 
-									Math.abs(oldAngle - neighbourAngle) < bestAngleDiff) {
+									Math.abs(oldAngle - neighbourAngle) < bestAngleDiff
+									&& ((int)Math.abs(neighbourAngle)) >= 2) {
 								bestAngleDiff = Math.abs(oldAngle - neighbourAngle);
 								bestCoord = cNeighbour;
 							}
@@ -315,6 +316,7 @@
 							log.debug("on Link", w);
 							log.debug("Corrected coord ", cConnection, "to",
 									bestCoord);
+							log.debug("Corrected orientation:",getAngle(c1, c2, bestCoord));
 						}
 						cConnection = bestCoord;
 					}
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to