logo separator

[mkgmap-dev] Route includes wrong types of ways

From Mark Burton markb at ordern.com on Wed Mar 4 10:06:23 GMT 2009

Hi Robert,

> This may well have to do with the destination class of that arc. It  
> would currently be set to the class of the major road, since that's  
> where it leads. It seems the way it is being computed is not always  
> appropriate.

In this particular case, all of the roads are class 0 (service &
residential). Making the residential roads class 1 should solve
the problem (but it didn't, I just tried that and it seemed to make
no difference).

In general, perhaps the patch below is good (I have my doubts). Just
guessing really.

Another thing, I notice that addArc() in RouteNode doesn't pay any attention
to the fact that the arc being added could be a reverse arc on a oneway road
which will never be used for non-pedestrian traffic. In that case, it would
be better not to increase the node's class to match the arc's class. Imagine
a one way primary road reaching a junction of secondary roads, the class of
the node should not be the primary road's class but the max of the
secondary roads' class values.

Cheers,

Mark

------------------------------

diff --git a/src/uk/me/parabola/imgfmt/app/net/RouteArc.java b/src/uk/me/parabola/imgfmt/app/net/RouteArc.java
index 3a25e46..bca7b43 100644
--- a/src/uk/me/parabola/imgfmt/app/net/RouteArc.java
+++ b/src/uk/me/parabola/imgfmt/app/net/RouteArc.java
@@ -195,7 +195,12 @@ public class RouteArc {
                log.debug("writing arc at", offset, ", flagA=", Integer.toHexString(flagA));
 
                // fetch destination class -- will have been set correctly by now
-               setDestinationClass(dest.getNodeClass());
+               int nc = dest.getNodeClass();
+               int rc = roadDef.getRoadClass();
+               // don't use a higher class than this arc's class
+               if(nc > rc)
+                       nc = rc;
+               setDestinationClass(nc);
 
                // determine how to write length and curve bit
                int[] lendat = encodeLength();



More information about the mkgmap-dev mailing list