[PATCH v5] - merge nodes to remove evil short arcs

v5 as per Marco's suggestion, it now merges points whose coordinates are equal rather than testing against a distance. misc minor tweaks. ---------- v4 based on r1044 ---------- v3 now requires the --remove-short-arcs option to enable this feature now deletes consecutive identical points ---------- v2 now reports OSM ids of merged/replaced nodes (at the cost of using more memory while the XML is being converted). only does this stuff if route option enabled. ---------- The attached patch is a first stab at a solution for this problem. Please test. It is implemented in an iterative fashion and it should terminate after a few passes. If 10 passes are executed it will give up, please report if you see it doing that. It would be nice if the diagnostics reported the OSM id of the nodes rather than their coordinates but I haven't worked out the best way of achieving that yet. Cheers, Mark

have checked some of the failing ways and they are all bad data where a way is folded once ore more times and the segments share the same nodes. one example http://www.openstreetmap.org/browse/way/28554391 there is probably nothing mkgmap can do. data is broken and must be fixed. nice to have another tool to verify osm data! On 28 May 2009, at 14:05 , Mark Burton wrote:
v5
as per Marco's suggestion, it now merges points whose coordinates are equal rather than testing against a distance.
misc minor tweaks.
----------
v4
based on r1044
----------
v3
now requires the --remove-short-arcs option to enable this feature
now deletes consecutive identical points
----------
v2
now reports OSM ids of merged/replaced nodes (at the cost of using more memory while the XML is being converted).
only does this stuff if route option enabled.
----------
The attached patch is a first stab at a solution for this problem.
Please test.
It is implemented in an iterative fashion and it should terminate after a few passes. If 10 passes are executed it will give up, please report if you see it doing that.
It would be nice if the diagnostics reported the OSM id of the nodes rather than their coordinates but I haven't worked out the best way of achieving that yet.
Cheers,
Mark <mb-short-arc-fix- v5.patch>_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Apollinaris Schoell schrieb:
have checked some of the failing ways and they are all bad data where a way is folded once ore more times and the segments share the same nodes. one example http://www.openstreetmap.org/browse/way/28554391 there is probably nothing mkgmap can do. data is broken and must be fixed. nice to have another tool to verify osm data!
I personally wouldn't create such a way, but is it an invalid one? Is it written somewhere for osm data that a way is not allowed to intersect itself? If these are valid ways then mkmap has to handle it properly. Regards, Johann

Johann Gail escribió:
Apollinaris Schoell schrieb:
have checked some of the failing ways and they are all bad data where a way is folded once ore more times and the segments share the same nodes. one example http://www.openstreetmap.org/browse/way/28554391 there is probably nothing mkgmap can do. data is broken and must be fixed. nice to have another tool to verify osm data!
I personally wouldn't create such a way, but is it an invalid one? Is it written somewhere for osm data that a way is not allowed to intersect itself?
JOSM validator plugin warns you when trying to upload auto-intersecting ways, but I'm afraid many people doesn't use validator. I also checked a couple of failing ways and they were also auto-intersecting. Regards Carlos

lot of things are possible im osm. does it mean we should do it? a way with loops must be broken for routing and this will change the topology. doesn't really matter how it's done it's always a modification of the topology. doesn't matter how it's done. now it's probably broken which is as good as any other solution. On 28 May 2009, at 18:10 , Johann Gail wrote:
Apollinaris Schoell schrieb:
have checked some of the failing ways and they are all bad data where a way is folded once ore more times and the segments share the same nodes. one example http://www.openstreetmap.org/browse/way/28554391 there is probably nothing mkgmap can do. data is broken and must be fixed. nice to have another tool to verify osm data!
I personally wouldn't create such a way, but is it an invalid one? Is it written somewhere for osm data that a way is not allowed to intersect itself?
If these are valid ways then mkmap has to handle it properly.
Regards, Johann _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hi Apollinaris,
lot of things are possible im osm. does it mean we should do it? a way with loops must be broken for routing and this will change the topology. doesn't really matter how it's done it's always a modification of the topology. doesn't matter how it's done. now it's probably broken which is as good as any other solution.
Loops and self intersecting ways in general are broken into multiple ways to avoid routing problems. It may be that code needs to be revisited to check if it handles all cases but I believe it handles most "sensible" way topologies OK. Cheers, Mark
participants (4)
-
Apollinaris Schoell
-
Carlos Dávila
-
Johann Gail
-
Mark Burton