logo separator

[mkgmap-dev] Short Arc Problem? Error 3 Mapsource, Problem on Calculating this route Basecamp.

From Steve Ratcliffe steve at parabola.me.uk on Fri Jan 4 14:59:54 GMT 2013

Hi

> Input:
> way 114405617 [highway=tertiary; ref=GI-681]
> way 81232137 [no tags]
> relation 1596434 [area=yes; highway=residential; type=multipolygon]
>
> Output of the mp algorithm:
> way 114405617 [highway=tertiary; ref=GI-681]
> way 81232137 [no tags]
> way C114405617 [area=yes; highway=residential; mkgmap:mp_created=true;
> mkgmap:stylefilter=polyline]
> way C81232137 [area=yes; highway=residential; mkgmap:mp_created=true;
> mkgmap:stylefilter=polyline]
> way P1596434 [area=yes; highway=residential;  mkgmap:mp_created=true;
> mkgmap:stylefilter=polygon]
>
> C114405617 is a copy of 114405617
> P1596434 is the resulting polygon of the mp.

Thanks for the explanation. Everything is just as you say and
there is no bug there.

I've now tracked down the problem. The tertiary way 114405617 and its
copy C114405617 share the list of Coord objects. Not just the actual
Coord's (which is correct) but the ArrayList too. Code in
addRoadWithoutLoops() replaces the nodes that have a highwayCount
greater than 1 with CoordNode objects.  If the tertiary way is
processed first then it will end up properly routable. When the copy
is processed however, the nodes have already been replaced and have no
highwayCount, so it appears to have no connection to other roads to
the code. So you end up with a road without the correct routing
information which happens to crash MapSource.

The previous workaround removed the piece of road that ended up without
routing information. Sometimes that would be the MP copy and sometimes 
the original road - it just depends on which is done last.

Two solutions I can think of
1. Always ensure you have a (shallow) copy of the list.
2. Fix up the addRoadsWithoutLoops() to recognise that a way has
already been processed and do everything that would have been done
anyway.

I favour 1) hoping that there is no intentional sharing of lists
anywhere.

Attached is a patch that copies the list in the Way constructor. I'll
check all call sites to make sure there is no duplicate copying
later. This patch is instead of the previous workaround.

This kind of tagging that produces the problem is particularly common in 
Spain, in the UK I couldn't find any examples and in Germany there are 
only a few; perhaps one per tile. In fact the only German example I
tried to trace had been changed since I downloaded it and was no longer
a problem. Every Spanish example I looked at was a sure routing failure 
however.

..Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Routing_error2.patch
Type: text/x-patch
Size: 1157 bytes
Desc: not available
Url : http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20130104/2131aa94/attachment.bin 


More information about the mkgmap-dev mailing list