Hi Mark,

> > I came across an incompletely mapped area that has some dead-end oneways,
> > and mkgmap duly complained.  Initially, I "fixed" this with a bogus road
> > that had a FIXME tag, but the original mapper reverted that change.
> > Now I have added fixme=continue to each bogus oneway.  I wanted to suppress
> > the dead-end check if the endpoints of the oneway have FIXME or fixme set,
> > but neither Coord nor CoordNode carry any OSM attributes.  Where could
> > this be achieved?  I would rather not add any mkgmap:dead-end-check=no
> > to the OpenStreetMap repository?  The FIXME would be more universal and
> > also show up in validators.
> 
> Yes, something like that could be done. Not sure about doing it for
> FIXME=*, though because if it said FIXME='not sure about road name'
> or something else that was unrelated to the routing/connectivity of
> the way then disabling the dead end check would not be appropriate.

I put my foot where my mouth is and implemented this in the OSM parser:
if either endpoint of a oneway carries a FIXME or fixme attribute,
mkgmap:dead-end-check=false will be added to the way.  It is left as an
exercise for the reader to port the patch to the MP parser. :-)

I tested the patch with --report-dead-ends 1 and 2 and got zero or
several oneway warnings, depending on whether FIXME was set on the
way endpoints.

Best regards,

        Marko
Index: src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java	(revision 1413)
+++ src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java	(working copy)
@@ -91,6 +91,7 @@
 
 	private Node currentNode;
 	private Way currentWay;
+	private Node currentWayNode;
 	private Relation currentRelation;
 	private long currentElementId;
 
@@ -363,6 +364,13 @@
 				String highway = currentWay.getTag("highway");
 				if(highway != null ||
 				   "ferry".equals(currentWay.getTag("route"))) {
+					// if the last Node of the Way has a FIXME attribute,
+					// disable dead-end-check for oneways
+					boolean oneway = currentWay.isBoolTag("oneway");
+					if (oneway && currentWayNode != null && (currentWayNode.getTag("FIXME") != null || currentWayNode.getTag("fixme") != null)) {
+						currentWay.addTag("mkgmap:dead-end-check", "false");
+					}
+
 					// if the way is a roundabout but isn't already
 					// flagged as "oneway", flag it here
 					if("roundabout".equals(currentWay.getTag("junction"))) {
@@ -378,7 +386,7 @@
 					if(makeOppositeCycleways &&
 					   cycleway != null &&
 					   !"cycleway".equals(highway) &&
-					   currentWay.isBoolTag("oneway") &&
+					   oneway &&
 					   ("opposite".equals(cycleway) ||
 						"opposite_lane".equals(cycleway) ||
 						"opposite_track".equals(cycleway))) {
@@ -453,6 +461,7 @@
 					motorways.add(currentWay);
 				if(generateSea && "coastline".equals(currentWay.getTag("natural")))
 				    shoreline.add(currentWay);
+				currentWayNode = null;
 				currentWay = null;
 				// ways are processed at the end of the document,
 				// may be changed by a Relation class
@@ -898,13 +907,14 @@
 
 	private void addNodeToWay(long id) {
 		Coord co = coordMap.get(id);
+		currentWayNode = nodeMap.get(id);
 		//co.incCount();
 		if (co != null) {
 			if(linkPOIsToWays) {
 				// if this Coord is also a POI, replace it with an
 				// equivalent CoordPOI that contains a reference to
 				// the POI's Node so we can access the POI's tags
-				Node node = nodeMap.get(id);
+				Node node = currentWayNode;
 				if(!(co instanceof CoordPOI) && node != null) {
 					// for now, only do this for nodes that have
 					// certain tags otherwise we will end up creating
@@ -927,7 +937,7 @@
 							// associated with
 							cp.setNode(newNode);
 							co = cp;
-							node = newNode;
+							currentWayNode = node = newNode;
 							break;
 						}
 					}
@@ -939,6 +949,13 @@
 					log.info("Linking POI " + node.toBrowseURL() + " to way at " + co.toOSMURL());
 				}
 			}
+
+			// if the first Node of the Way has a FIXME attribute,
+			// disable dead-end-check for oneways
+			if (currentWay.getPoints().size() == 0 && currentWayNode != null && (currentWayNode.getTag("FIXME") != null || currentWayNode.getTag("fixme") != null)) {
+				currentWay.addTag("mkgmap:dead-end-check", "false");
+			}
+
 			currentWay.addPoint(co);
 			co.incHighwayCount(); // nodes (way joins) will have highwayCount > 1
 			if (minimumArcLength != null || generateSea)
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to