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
Index: src/uk/me/parabola/mkgmap/reader/osm/Way.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/Way.java (revision 2432)
+++ src/uk/me/parabola/mkgmap/reader/osm/Way.java (revision )
@@ -50,7 +50,7 @@
}
public Way(long id, List<Coord> points) {
- this.points = points;
+ this.points = new ArrayList<Coord>(points);
setId(id);
}
Index: src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java (revision 2432)
+++ src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java (revision )
@@ -1487,7 +1487,9 @@
int numNodes = nodeIndices.size();
road.setNumNodes(numNodes);
-
+ if (numNodes == 0) {
+ System.out.println("ZERO NODES: " + way.getId());
+ }
if(numNodes > 0) {
// replace Coords that are nodes with CoordNodes
boolean hasInternalNodes = false;
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev