Hi Chris,

> Hi,
> In V1340 my error file is no longer empty :
> 
> SCHWERWIEGEND (RoadNetwork): Road null (OSM id 24660945) contains zero
> length arc
> SCHWERWIEGEND (RoadNetwork):
> http://www.openstreetmap.org/?lat=47.61462&lon=9.95615&zoom=17
> SCHWERWIEGEND (RoadNetwork): Road In den Weiden (50) (OSM id 25619933)
> contains zero length arc
> SCHWERWIEGEND (RoadNetwork):
> http://www.openstreetmap.org/?lat=48.72200&lon=9.37569&zoom=17
> SCHWERWIEGEND (RoadNetwork): Road In den Weiden (50) (OSM id 41263850)
> contains zero length arc
> SCHWERWIEGEND (RoadNetwork):
> http://www.openstreetmap.org/?lat=48.72200&lon=9.37569&zoom=17
> 
> 
> I am using the --remove-short-arcs option.

Yes, my recent change to MAX_POINTS_IN_WAY can introduce short arcs so
I have been working on a more intelligent version. Please try the
attached patch and tell me if the short arcs go away again.

Cheers,

Mark

diff --git a/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java b/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
index 3b1231a..6b0c81f 100644
--- a/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
+++ b/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
@@ -84,10 +84,9 @@ public class StyledConverter implements OsmConverter {
 	// limit arc lengths to what can currently be handled by RouteArc
 	private final int MAX_ARC_LENGTH = 80000;
 
-	// MAX_POINTS_IN_WAY has been revised down as this appears to fix
-	// some routing issues - not 100% confident that this is the real
-	// solution
-	private final int MAX_POINTS_IN_WAY = 80;
+	private final int MAX_POINTS_IN_WAY = 200;
+
+	private final int MAX_POINTS_IN_ARC = 50;
 
 	private final int MAX_NODES_IN_WAY = 16;
 
@@ -1009,6 +1008,7 @@ public class StyledConverter implements OsmConverter {
 		// collect the Way's nodes and also split the way if any
 		// inter-node arc length becomes excessive
 		double arcLength = 0;
+		int numPointsInArc = 0;
 		for(int i = 0; i < points.size(); ++i) {
 			Coord p = points.get(i);
 
@@ -1033,12 +1033,33 @@ public class StyledConverter implements OsmConverter {
 					// points so the loop will now terminate
 					log.info("Splitting way " + debugWayName + " at " + points.get(i).toOSMURL() + " to limit arc length to " + (long)arcLength + "m");
 				}
+				else if(numPointsInArc >= (MAX_POINTS_IN_ARC / 2) &&
+						points.size() > MAX_POINTS_IN_ARC &&
+						p.getHighwayCount() > 1) {
+					// this point is already a node so it's a good place
+					// to split the way
+					log.info("Splitting way " + debugWayName + " at " + points.get(i).toOSMURL() + " (using an existing node) to limit number of points in this arc to " + numPointsInArc + ", way has " + (points.size() - i) + " more points");
+					trailingWay = splitWayAt(way, i);
+					// this will have truncated the current Way's
+					// points so the loop will now terminate
+				}
+				else if(numPointsInArc >= MAX_POINTS_IN_ARC &&
+						safeToSplitWay(points, i, i - numPointsInArc, points.size() - 1)) {
+					// we have to split the way here
+					log.info("Splitting way " + debugWayName + " at " + points.get(i).toOSMURL() + " (making a new node) to limit number of points in this arc to " + numPointsInArc + ", way has " + (points.size() - i) + " more points");
+					trailingWay = splitWayAt(way, i);
+					// this will have truncated the current Way's
+					// points so the loop will now terminate
+				}
 				else {
-					if(p.getHighwayCount() > 1)
+					if(p.getHighwayCount() > 1) {
 						// point is a node so zero arc length
 						arcLength = 0;
+						numPointsInArc = 0;
+					}
 
 					arcLength += d;
+					++numPointsInArc;
 				}
 			}
 
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to