logo separator

[mkgmap-dev] Commit: r888: Add zero to the bit array when the road does not end in a node

From Johann Gail johann.gail at gmx.de on Sun Feb 15 10:09:58 GMT 2009

>
> I based the startsWithNode special-casing on the evidence I saw in 
> cGPSmapper-created maps: 
> http://www.mkgmap.org.uk/pipermail/mkgmap-dev/2008q4/000220.html
>
> There's never an increased nbits for a road not ending in a node. I'd 
> prefer to leave this change out unless it's shown to help.
>
> Of course, if cGPSmapper counts missing nodes at road ends a bug, 
> perhaps we shouldn't try to imitate what it does if they're present 
> too faithfully.
>
My patch was only a wild guess without any deep investigation.
I have wondered the whole day about the error with the pink line gets 
drawn false. It has something to do with a end node present or not.
When I have seen the special handling for the starting node, I just gave 
it a try and have done the similar thing with the end node. For my test 
situation the error was gone. I don't know, if it has broken somthing other.

Maybe the error was not in the final node, but in the incorrect loop 
writing the bits. I will give it a try.

If you use the patch on the current svn version, it will do nothing, as 
there are at the moment end nodes on each dead end road.


>> Also fix the loop that writes the array out.
>
> To fix the bug, I'd prefer this change (assuming I didn't mess it up):
>
> +            for (int j = 0; j < 8 && j < bits.length - i; j++)
> +                if (bits[i+j])
>                      b |= 1 << j;
>              writer.put((byte) b);
>
That's okay for me, I think your solution is a little more efficient, as 
it saves the double  multiplication.



More information about the mkgmap-dev mailing list