Routable Garmin maps: http://emexes.powweb.com/osm/

Hi Folks,

This is my first post on this forum, because I wasn’t aware that it exists. Shame on me.

I have seen Garmin maps are a common topics here. I also tried recently to use OSM data on my Garmin device, but I think I have totally different approach that the one commonly presented here.

I understand the major drawback (or better call it lack of feature) of all existing maps generated from OSM data is that they are not routable?

If that’s not the case, then please correct me, because I am currently working on automatic conversion tool which uses cGPSmapper as compiler and I already have first routable (more or less) map of Germany (as test area for time being, but possible to generate from any area). If someone already have done that, then I will use my time better than redesigning a wheel.

If not, then I will probably have some questions regarding legal/license issues for making these tool/maps available for free for comunity.

Ra

Edit:
Routable maps for Garmin created from OSM data are available on: http://emexes.powweb.com/osm/.
You can also download tool (by Liosha) which converts OSM data into Mp files which can be compiled on mapcenter2. See later posts for a link.

Edit by Lambertus: Change topic title to reflect the topic content better

Edited by Radomir: Added download url

Yes, thats true. But work is being done to be able to provide routable maps in two major ways:

  1. Make Mkgmap produce routable maps (the final goal).
  2. Make Mkgmap produce intermediate files in the Polish format (.mp) that can be processed by cGPSMapper. This is considered an ‘in-between solution’.

Well, you are not the only one working on the same problem, but I have no idea how far the author (and others) are with their attempt to let Mkgmap produce .mp files.

I would suggest that you contact the author of Mkgmap and maybe also Carl Newman who stated that he works on this as well.

OSM users in Russia decided to take the same approach as Lambertus described - to make a tool for.osm → .mp conversion and then process .mp with cGPSMapper. As far as I know, the main work is done by User:Liosha. There is a table with types attribution - http://wiki.openstreetmap.org/index.php/ВикиПроект_Россия/Garmin .

Also another user on Talk page suggested to use OSMGarminMap - http://wiki.openstreetmap.org/index.php/OSMGarminMap . Though id doesn’t support API 0.5, it still works on exporting the data. The usage is:

  1. Take osm2mpx.xml, osm2mpx.xsl, feature-list.xml, mpx2mp.xsl,
  2. Download data and save it as data.osm
  3. Run xsltproc osm2mpx.xml > map.mpx
  4. Run xsltproc feature-list.xml > map.mp

Feature-list.xml contains old features only but it’s still better than nothing.

Yep, I’m working on a routable map converter, but very slowly. It’s mostly in the conceptual phase now, no code yet. My plan was to go through the .mp format, because I understand that well, and later if someone (else) decodes the binary routing format, then the tool could be adapted to write that directly. My current plan is to use Osmosis as a base because it has a well-written pipeline and support for a lot of input sources. I’ve defined a proposed rules file format on my Wiki page here: http://wiki.openstreetmap.org/index.php/User:SiliconFiend/Ruleset. I’ve also defined some project requirements (mostly just a brain dump) here: http://wiki.openstreetmap.org/index.php/User:SiliconFiend/Projects/Requirements The thing that’s holding me up mostly now is designing the architecture.

By the way, I took the old OsmGarminMap xsl sheets and updated them to work with the 0.5 api and also add routing support. However, XSL is the wrong tool for the job; it completely chokes on even 10 MB of data. But if you want to see my work and try it with a small area, my files are here: http://www.migratingcoconuts.com/pub/osmgarminmap/ You can test the output in GPSMapEdit–it has support for testing the routing graph.

Karl

Salut!

I’m also working on OSM → MP converter :slight_smile:
Current version supports multipolygons and routing (pseudo, without turn restrictions).
You can download it here: http://garminmapsearch.com/osm/osm2mp_v04.zip
It’s still in early phase, sorry for dirty code :slight_smile:

Usage: osm2mp.pl file.osm > result.mp
Some examples, updated daily: http://garminmapsearch.com/osm/mp/
Main discussion in Russian: http://forum.openstreetmap.org/viewtopic.php?id=694

It was tested with up to 2GB .osm files from http://download.geofabrik.de/osm/europe

Hi,

Thanks for working on this. Since I can’t participate in the Russian discussion, I hope you won’t mind me posting here. I tried to generate a map of Ireland using this method. Your script very quickly produced what looks like a complete and valid .mp file. Feeding this to the cGPSmapper web service didn’t produce a working map, but it looks like it may have come very close. The problem seems to be that my data contained routing nodes that were closer together than 5.4m, and cGPSmapper appears not to like this. I got quite a few of the same errror, but here’s the tail end of it:

Distance is below 5.4, NODID1: 33771, NODID2: 13433 RgnID: 24005

Distance is below 5.4, NODID1: 14121, NODID2: 32874 RgnID: 24043

Distance is below 5.4, NODID1: 34106, NODID2: 35454 RgnID: 24112
Error R011: NODID points cannot be closer than 5.4 meter!
ERROR: Resulting IMG file ‘35301972.img’ not found

I’ve investigated some of the problem cases. At least one of the examples I found really did have nodes that close (and it was possible to fix it). Other cases seem less easy to fix without local knowledge. Also, it would take a long time.

I’ve been looking into the code and it seems like it should be possible to avoid this case by lying a little to cGPSmapper. If we could detect when two nodes are too close to make any difference, we would report only one node. Does this seem a valid approach? I’m guessing that CPAN can provide a distance measurement module, though I’m sure that what I have in mind will slow things down.

Is it valid to do this only for the Nod entries or should I try to simplify the entire polyline?

Dermot

mackerski,
of course it is possible to detect such close points, but there are some problems:

  • it’ll take much more time, because we need n^2 distance measurements
  • it is not clear what to do after we detect them. joining nodes is not a good idea

you can use cgpsmapper with -e parameter to skip errors (it will join close nodes)
also you can open .mp with GpsMapEdit and use “Verify map” tool

Not for what I had in mind (though maybe my idea isn’t sufficiently complete). I was only interested in avoiding nodes that are too close to each other along the same way. So the necessary check for this will be much more limited. If nodes along other ways cause a problem then at least we should find that there are much fewer of them.

I agree that it could cause some unexpected results - but again, as long as we only do it within an existing way I’m hoping the effect will be minimal.

That’s not so easy - if I understand correctly, the free version of cgpsmapper doesn’t support the routing information, and that’s what I’m interested in here. I already have non-routable maps on my Garmin devices. So my test used the online compiler, and I didn’t see any way to set the -e parameter.

I’ll experiment with merging nodes and see how far I get.

Thanks,
Dermot

there is no need for such checks.
converter creates nodes only on road intersections, so not every OSM node become MP node :slight_smile:

you can use personal version of cgpsmapper - it supports routing and have 1 month trial period

Sorry, I should have been clearer. The cases I’m having trouble with are where intersection nodes occur too close together along the same way. Sometimes this is just bad mapping, such as a crossroads with two nodes instead of one. But sometimes it can be a junction where both a road and a footpath beside it intersect the same road very close to each other.

That’s handy. I’ll try that.

Thanks,
Dermot

Ok, now i understand :slight_smile:
i’ll think about it, but imho it’s not a task for converter
it would be better to make standalone script for MP preprocessing

Joining nodes is exactly what i am doing. The assumption is “if the nodes are so close then what’s the difference - the driver will find it’s way anyway”. I know that this not solves the problem pretty, but it is better the have the routable maps of a country with a few joined nodes than nothing at all.

From technical point of view: I use sweep algorithm. I am not sure if this is official name, but you can probably find it in the net. It sorts the nodes taking x coordinate at first at then looks only for those which are close enough when looking at X axis. It works faster than naive comparison of n^2 nodes.

I don’t compute the distance exactly, because I don’t believe cgpsmapper does that anyway. Computation of REAL distance between two points having their Geo-coordinates is quite expensive. I simply check if the distance is not larger that n seconds. I suspect this is exactly what cgpsmapper and Garmin are doing.

Joining of nodes is a first problem. When you solve this, then you encouter another - self intersecting roads. Garmin prohibits the routable road to cross the same point more than once. And there is lot of such roads in OSM (roundabouts are the obvious example). I am splitting those into two parts but with checking if I am not creating two routing nodes laying to near etc.

I managed to produce some maps this way. I have just started to test them. You can download an UK & Ireland map from http://nickb.dev.openstreetmap.org/public/Setup_OSM-UK-Ireland.exe, but please be aware that this is first version. Not even beta :wink:

Ra

Edit:
The link points to InnoSetup installer of a compiled set of maps. The installer installs it into Garmin MapSource program. There are no *.mp files there.

of course we do not need to make n^2 geo distance measurement :slight_smile:
there are many ways to optimize such process

but i advise just use cgpsmapper -e
and correct these errors in the OSM

this problem is already solved in my script - it splits self-intersecting ways :slight_smile:
it also filters some node dupes

Hi Liosha,

I had a quick look into your maps and they look very well. You have done a great job.

At first I thought you have lot of luck or very disciplined people working over map of Russia, because you have all the input data correct and I haven’t seen corrections implemented in your code. But I skimmed it quickly through so it is possible that I missed something.

Now I am a bit confused. Are you correcting the data in OSM manually? Do you do this in OSM or MP files?

LOL :laughing::lol:

I have some corrections implemented in code: duplicate nodes are filtered, self-intersecting roads are splitted.
I was found just 5 bad roads in Moscow area that causes fatal error in cgpsmapper, and i manually corrected them in OSM.
Now cgpsmapper can compile Moscow with -e switch (there are some errors like “too close nodes”, but they are not fatal).

I also made script that daily downloads some areas via osmxapi, converts them into MP and then tries to compile with cgpsmapper_free (w/o routing) and with cgpsmapper_personal.
Results are here: http://garminmapsearch.com/osm/mp/
As you can see, Saint-Petersburg area (piter_*) still can not be compiled with routing.

I have had some useful results with cgpsmapper -e. Trying to create a map of all Ireland still fails for some other reason, but that can probably be fixed.

I am a big fan of correcting bad data in the OSM data. However, this is not always possible (well, let’s say desirable). Take some cases:

  1. You have a simple crossroad. But instead of meeting on a single node, the junction includes two nodes about a metre apart. This is a mapper error and should be fixed and cgpsmapper will then be happy

  2. You have a small (but not mini) roundabout. cgpsmapper complains that the nodes on adjacent arms of the roundabout are too close together (BTW, I think you’re correct that the distance measurement it uses is inexact, because it has complained about nodes that IMHO are more than 5.4m apart).

The only way in the base data to make cgpsmapper stop complaining is to collapse the whole roundabout onto a single node (or fewer nodes in any case). This is bad for the navigation instructions that will result from this - because the junction will no longer be recognised as a roundabout. It’s also a very bad case of mapping-for-the-renderer, to remove map detail just because a single application can’t deal with it.

Preprocessing does, as you say, provide a solution to this.

  1. Junction of two dual-carriageways at traffic signals. In the standard case you will have four junction nodes. What if they are too close to each other? Once again, I don’t want to simplify that on the OSM side.

You can use the ‘merge nodes’ function in JOSM, after doing a rectangular selection around these nodes.

Split the roundabout into pieces at the crossings. Having ‘roundabout’ as topological object is a bad idea anyway.

I’m using some quick and dirty awk scripts to extract, download and edit certain OSM topological errors, but maybe we can extend
osm2mp to work as an osm2osm preprocessor. Then it will be possible to re-upload preprocessed data directly to the server.
It opens a big can or worms with concurrency, if two people will try to reprocess the same or overlapping areas simultaneously.
Fortunately, there are not that much people editing OSM late at night :slight_smile:

You can’t avoid ‘mapping-for-garmin’ here, so think out some soultion that will be commonly acceptable.

Error R009: Limit of 60 segments for a single road exceed.

osm2mp should deal with it, since it’s a garmin-specific problem.

Distance is below 5.4, NODID1: 9513, NODID2: 8571 RgnID: 14

It does not show up in gpsmapedit, but i will check again.

Internal error during split of RGN80 objects - if this is supported version of program - contact with gps_mapper

I doubt we can do something about cgpsmapper internal bugs without having the source code.
One more reason to finish the NOD research, add it to mkgmap and put this cgpsmapper guy out of the business :wink:

this fatal error is caused while trying to recover this error:

the way has nodes with different ID but with same coords. just redraw that way

I’m doing the full n(n-1)/2 distance qsort() on the original routable nodes table, so it just can’t happen.

edit:
sorry, the bridleways and similar weird ways were removed from the table. maybe it explains
what’s going on here.