cferrero.net      

Mapping la vida loca

 

 Home

 Photos

 Videos

 Maps

 About

Using mkgmap to improve OSM data

Concept

mkgmap can help you find errors in underlying OSM data which you can then edit (e.g. in JOSM or Potlatch) and thus not only improve your maps, but improve everyones' maps too.


Where do I start?

  1. Download this logging.properties file and save it in the same folder as the OSM data you want to process.
  2. Edit your mkgmap compile options to include one or more of the following switches:
  3. Compile the OSM data using mkgmap and add the following command: -Dlog.config=logging.properties. For example:
    java -jar -Dlog.config=logging.properties myosmdata.osm -c template.args
    Note this is a java option, not a mkgmap option.
  4. You will see lots of information spat out by mkgmap as it compiles the data. Simultaneously, mkgmap will write these to a file called mkgmap.log.0 (by default).
  5. Once mkgmap is finished, open the mkgmap.log.0 file with a text editor

Roundabout direction

mkgmap automatically assumes all roundabouts are one-way, and the sense of the way (clockwise or anti-clockwise) is determined by the direction of the underlying OSM way. If the underlying OSM way has the wrong sense it can lead to incorrect routing (your GPS may tell you to drive the wrong way around a roundabout), so --check-roundabouts will warn about this and correct the error in the Garmin file (but not in the OSM data, obviously).

If you enabled --check-roundabouts and --drive-on-left you will see errors like this:
2009/12/22 16:07:52 WARNING (StyledConverter): Roundabout 5154526 direction is wrong - reversing it
(see http://www.openstreetmap.org/?lat=52.91516&lon=-1.44998&zoom=17)

This means that the roundabout in question has an anti-clockwise sense of direction, which is incorrect for countries where you --drive-on-left. mkgmap has reversed the sense when it prepared the map so your routing won't be affected.

Solution: Check the OSM data and reverse the way in Potlatch or JOSM.

Roundabout flare roads

Roundabout flares are the roads that lead into, or away from, a roundabout. Here's an example with a red pin on it (you might have to zoom in a bit to see it clearly):

View Larger Map

This particular roundabout has 8 flare roads (one incoming and one outgoing for each road leading to the roundabout.

Flare roads should be marked as one-way in the OSM data, and they should point in the correct direction (i.e. if cars drive on the left, then the left-hand flare should lead towards the roundabout, and the right-hand flare should lead away from the roundabout). If you enable --check-roundabout-flares mkgmap will report the following types of error:

  1. Flare roads that point in the wrong direction
    2009/12/22 16:04:06 WARNING (RouteNode): Outgoing roundabout flare road (http://www.openstreetmap.org/browse/way/5067444) points in wrong direction?
    http://www.openstreetmap.org/?lat=51.60079&lon=-3.34426&zoom=17
    2009/12/22 16:04:24 WARNING (RouteNode): Incoming roundabout flare road (Southampton Road, http://www.openstreetmap.org/browse/way/10569173) points in wrong direction? http://www.openstreetmap.org/?lat=50.96704&lon=-1.35087&zoom=17

    These two errors denote that an outgoing flare seems to point towards the roundabout and an incoming flare seems to point away from the roundabout.

    Solution: Check the OSM data and reverse the ways.

  2. Flare roads that are not set as one-way
    2009/12/22 16:07:07 WARNING (RouteNode): Outgoing roundabout flare road (http://www.openstreetmap.org/browse/way/46608892) is not oneway?
    http://www.openstreetmap.org/?lat=52.22287&lon=-0.93744&zoom=17

    This error (and the equivalent incoming version) denotes that a flare road is not set to be one-way.

    Solution: Check the OSM data and set the flares as one-way.

  3. Flare roads that do not start or end at a flare
    2009/12/22 16:08:27 WARNING (RouteNode): Incoming roundabout flare road (http://www.openstreetmap.org/browse/way/43269385) does not start at flare?
    http://www.openstreetmap.org/?lat=52.61612&lon=1.31061&zoom=17
    2009/12/22 16:08:27 WARNING (RouteNode): Outgoing roundabout flare road (http://www.openstreetmap.org/browse/way/43269385) does not finish at flare?
    http://www.openstreetmap.org/?lat=52.61612&lon=1.31061&zoom=17

    This error indicates that an incoming (outgoing) flare road does not appear to start (finish) as a flare. In other words, it doesn't originate from (terminate to) a fork in the road. Quite often this is a false positive from mkgmap but sometimes finds genuine errors.

    Solution: Check the OSM data and verify why the flare road doesn't start or end at a flare.

Dead-ends

Incorrect use of one-way tags in OSM data can lead to roads that you cannot 'escape from'. In other words, the one-way road ends at a dead-end from which you could not theoretically leave without driving the wrong-way back up the road. A similar problem is when multiple one-way roads end at a single node. In this case, all the roads lead to a single point from which you again cannot 'escape' without driving the wrong way. If you enable --report-dead-ends mkgmap will report such one-way problems, for you to fix.

If you enabled --report-dead-ends you will see errors like this:
2009/12/22 16:04:06 WARNING (RouteNode): Oneway roads (Usk Way, http://www.openstreetmap.org/browse/way/40554922), (Usk Way, http://www.openstreetmap.org/browse/way/5086281) come from nowhere at http://www.openstreetmap.org/?lat=51.57435&lon=-2.98461&zoom=17

This error indicates that various one-way roads all originate from the same place. This place, therefore, is somewhere you can't actually "reach" if you obey the one-way rules. Quite often this happens when an area is incompletely surveyed and not all roads have been added, but sometimes it is a genuine error.

Solution: Check the OSM data and verify whether one of the roads has been incorrectly determined as one-way.

Routing restriction errors

Irrespective of any mkgmap command switches you use, mkgmap will always output routing restriction errors. These are of various types:
  1. Extra members
    2009/12/22 16:03:46 WARNING (RestrictionRelation): Turn restriction http://www.openstreetmap.org/browse/relation/288490 (at http://www.openstreetmap.org/?lat=50.72180&lon=-3.47938&zoom=17) has extra 'via' member http://www.openstreetmap.org/browse/node/497705546

    This error indicates that the turn restriction in question has too many 'via' members. Similar errors apply to 'from' and 'to' members.

    Solution: Check the OSM data and fix the relation so that it only has one 'via' member.

  2. Incorrect use of via
    2009/12/22 16:03:46 WARNING (RestrictionRelation): Turn restriction http://www.openstreetmap.org/browse/relation/288490 (at http://www.openstreetmap.org/?lat=50.72180&lon=-3.47938&zoom=17) 'to' way http://www.openstreetmap.org/browse/way/42490984 doesn't start or end at 'via' node or way

    This error indicates that the turn restriction is set up incorrectly. Per the OSM wiki the 'from' and 'to' members of a turn restriction should meet at a common 'via' node. The mkgmap error indicates that the restriction in question does not follow the wiki rules.

    Solution: Check the OSM data and edit the relation so that the 'from' and 'to' members meet at a common 'via' node.

  3. Unknown member
    2009/12/22 16:04:00 WARNING (RestrictionRelation): Turn restriction http://www.openstreetmap.org/browse/relation/305407 (at http://www.openstreetmap.org/?lat=51.61943&lon=-3.94995&zoom=17) unknown member role ''

    This error indicates that a restriction has a member that is not one of 'via', 'to' or 'from'. This usually results from someone splitting a way but not fixing the restriction.

    Solution: Check the OSM data and either set the unknown member to one of 'via', 'to' or 'from', or delete it.

  4. No restriction type set
    2009/12/22 16:04:00 WARNING (RestrictionRelation): Turn restriction http://www.openstreetmap.org/browse/relation/305408 lacks 'restriction' tag (e.g. no_left_turn)

    This error indicates that a restriction exists (i.e. the tag type=restriction has been set) but that no restriction=x tag exists. Per the OSM wiki any turn restriction must have a tag denoting what type of turn restriction it is (e.g. no_right_turn, no_left_turn etc).

    Solution: Check the OSM data and (if you can) assign the correct turn restriction tag. Quite often this will be impossible if you don't know the area, in which case add a FIXME tag to the 'via' node asking someone with local knowledge to fix it.

  5. Missing member
    2009/12/22 16:04:00 WARNING (RestrictionRelation): Turn restriction http://www.openstreetmap.org/browse/relation/305409 lacks 'from' way
    Per the OSM wiki all turn restrictions consist of three members: a 'via' node, a 'from' way and a 'to' way. This error (and the corresponding 'via' and 'to' versions) indicates that the restriction lacks one of these three required members.

    Solution: Check the OSM data and (if you can) add the appropriate member. If you cannot determine what it should be, add a FIXME tag asking someone with local knowledge to fix it.

Addendum

Note that in many cases I've fixed the errors listed above, so if you check them you may find that they no longer occur in the OSM data.
  Copyright 2005-2010 All Rights Reserved cferrero.net