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.
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
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 .
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.
I’m also working on OSM → MP converter
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
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?
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.
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.
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 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?
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:
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
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.
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
You can’t avoid ‘mapping-for-garmin’ here, so think out some soultion that will be commonly acceptable.