Mapnik layout (TYP file) for Garmin osm maps

In order to find a good TYP file for the default mgkmap styles, I found the mapnik.TYP from Lionel aka Petrovsk (1) very useful:
http://blog.lionelmaraval.fr/post/2010/01/23/Carte-pseudo-mapnik-pour-Garmin

Lionel gave his permission to enhance this typ file and maybe Lambertus can add it to his osm routable world maps later.

Because some areas were not rendered very well, I modified a few things and put it here to download:
http://mijndev.openstreetmap.nl/~ligfietser/diverse/mapnik.TYP

The results can be seen here:

http://sites.google.com/site/openfietsmap/osm-1

There are still items that are not rendered at all, like landuse=grass or highway=cycleway is rendered the same as footway etc
Those things have to be changed in the default mkgmap styles, it cannot be controlled by the TYP file.

If you have more suggestions to improve this TYP file let me know.

Edit:
-Please note that this TYP file has not been updated with the latest changes in the mkgmap style files
-For installing the Typ file into the world routable osm map you need Mapsettoolkit: http://sites.google.com/site/cypherman1/
-See this screenshot: http://mijndev.openstreetmap.nl/~ligfietser/diverse/mapsettoolkit.jpg

One thing to be aware of - older Garmin units do no render lines with borders well: here are some example screengrabs from my GPSMap76Csx using your mapnik.TYP

http://cferrero.net/maps/img/spag1.bmp
http://cferrero.net/maps/img/spag2.bmp
http://cferrero.net/maps/img/spag3.bmp

The unit draws the road border around the end of the way, making a map full of spaghetti. This is unusable and therefore not really suitable as a mkgmap default unless you want to have two TYP files (one for newer units, which can display road borders properly) and one for older units which don’t display borders properly).

Thanks Charlie,
There are two ways to define a line in the ati.land.cz editor,

Attributes: Bitmap height: 0
Line style: Width= 5 px

or

Attributes: Bitmap height: 5

And in the bitmapeditor: 11111111…

Which one is better for the older units, or does it not make any difference as long there are no road borders?

I’ve been adopting the above typ file for a while and agree with Charlie that the polyline border colours are causing a spaghetti like effect. However, a way around it , is to use light greys for the border, ie #d5d5d5 Have tested this on both Etrex and Oregon and it’s not generating such an eyesaw. I’m not, however, too impressed with the typ’s rather bland pois.

I changed the borders in the Mapnik2.typ file with d5d5d5,

See http://mijndev.openstreetmap.nl/~ligfietser/diverse/

ligfietser - I still think that’s unusable on a GPSMap device. See this shot created using mapnik2:
http://cferrero.net/maps/img/spag4.bmp
vs
this shot created using my own TYP file:
http://cferrero.net/maps/img/nospag.bmp

Thanks for testing it out.

The problem with roads without border lines is that some of them (yellow tertiairy) will not be visible at all against this yellow background. If I make the background white, the unclassified roads are not visible anymore. Ok, I can change the colours of either one of them but then it doesn’t look like the Mapnik osm map anymore. So I have to seek a compromise, like a borderline only on the yellow roads.

Is there any particular reason you want it to look like the Mapnik map?

Simply because it’s the most common osm renderer on the web. I agree it’s not the best when converted to the Garmin format, but for first time users its more recognizable when they see the same map on their garmin unit as on their pc. At the moment Lambertus Garmin world map doesn’t use a TYP file and especially in the Netherlands with all the recently imported topo data the Garmin map looks horrible without a TYP file. So it’s just a start, eventually more alternative TYP files can be designed if there is a demand for them.

Hi ligfietser

thanks for your effort, this is exactly what I always wanted to have, “seeing OSM when using OSM.” The only problem is, that it doesn’t work yet on my nüvi 765.
Unfortunately I’m not really familiar with all the tools around OSM, so I would be thankful for some easy explanation.

Let me first tell what I did so far:

  1. I downloaded OSM data from Geofabrik.de
  2. converted this in .img-format with mkgmap
  3. I tried to combine the .img-file with your mapnik2.typ-file by using “MapSetToolKit_v1.77”
  4. Sent the map with mapsource on my device

Now the problems are the following:

  • In mapsource I have the “Mapnik-Style”, on my nüvi it looks the same as always, no change.
  • The MapSetToolKit tells me, that the Family ID and the Product Code aren’t the same in the .TYP as the ones I entered in MapSetToolKit. Which numbers are the correct ones?

What do I make wrong?

Thanks for your help!

Since you are making your own map with mkgmap I dont know which Family ID and product ID you have set. Those are the ones you need to enter. They are likely to be different than the ones in the TYp file. Does mapset toolkit ask you to correct the Family ID and Product code in the TYP file? If so, just confirm.

Hi

Thanks for your help, now it works! I never set any Family-ID or Product-ID in mkgmap, that was the problem.
I’ll test how the map behaves on the nüvi and report here.

regards M.

Hi, Ligfietser!

Thanks for this link and answering my question about the difference between Garmin OSM maps and maps with Type file layout. I will be back in the Dutch user forum.

Regards O2

I have found a trick to make the spaghetti lines more bearable :wink: by placing two lines on top of each other.
One line is routable and has borders. The other line is non routable and has no borders, only a solid colour.
In the line style file it looks like this:

highway=x [0x060 road_speed=1 road_class=1 resolution 20]

In the overlays file:

0x060: 0x06, 0x10106

In the typ file 0x06 is for instance the line width=3 border=1

[_line]
Type=0x06
UseOrientation=N
LineWidth=3
BorderWidth=1
Xpm=“0 0 2 0”
“1 c #FFFFFF
“2 c #393000
String1=0x04,street
String2=0x03,straat
String3=0x02,Straße
ExtendedLabels=Y
FontStyle=SmallFont
CustomColor=No
[end]

0x10106 can be a line width=3 border=0 or a 3 pixels wide bitmap:

[_line]
Type=0x10106
UseOrientation=N
LineWidth=3
Xpm=“0 0 1 0”
“1 c #FFFFFF
ExtendedLabels=Y
FontStyle=NoLabel (invisible)
CustomColor=No
[end]

The result is looking much better on my old Etrex device:

without overlay

with overlay 0x10106

Of course on a newer generation GPS like the Dakota it looks more pretty, but the differences are not too big:

Clever. I might give this a go…the trouble is I use different thicknesses at different zoom levels so keeping track of things is already a nightmare without then trying to make use of overlays.

I’m using this trick only for the highest zoomlevels. The lower the zoom, the thinner the roads, and on those levels it isnt too much of a problem. The only problem I still have is that I also want to indicate bike routes on top. This is not possible unless I make ‘window’ holes in the 0x10106 bitmap. Disadvantage of those holes is that the roads on my latest map still shows a bit more spaghetti effect. See for an example http://sites.google.com/site/openfietsmap/news/22-04-2011

What you have done here is awesome and it looks really good. However:

On the web, yes and it produces a professional looking map on screen and possibly when printed (haven’t tried that yet). But the requirements on a GPS are a little different. You want to be able to see roads at a glance. The screen is very small, so you don’t want too much clutter. When driving you don’t have much time to look at the screen, you need to get info quickly and make decisions on where to go based on that (unless you are being routed, but even then: the instructions are not always correct).

Personally, I don’t want too much detail apart from roads and rivers, maybe rail lines. What I do want is contrast.

I have experimented a little with typ files myself, because my Zumo 660 displays minor roads almost the same as dirt tracks: a thin grey line on a white background. (This is a motorcycle GPS…) I have found that no matter how I try you cannot have dashed or dotted lines in a typ file on the Zumo. The reason is that any transparent colour appears as non-tranparent black. You may want to bear that in mind.

Regards,
Peter.

I’d like to do a test run for the whole planet and publish it as experimental via the website.

Will this TYP file show the sea polygons when the maps are generated with the default stylesheet or marine stylesheet? And will this commandline you referenced in one of your emails to the Mkgmap dev list work?

--generate-sea=extend-sea-sectors,close-gaps=6000,floodblocker,land-tag=natural=background

And shouldn’t there be another parameter ‘polygons’?

Hi Lambertus,
The default style doesn’t have a land-tag like natural=background or natural=land. And therefore i didnt add it in the mapnik.typ file as well, the typ file does however have a tag for natural=sea. The tag natural=background I have invented myself for the OFM because natural=land is already used to tag islands in a lake or something. If you leave that land-tag out I dont know what the consequences are for the rendering. I dont use a parameter ‘polygons’.

Another option is to adapt the default style and use your own style (you can add a line like natural=land or background, throw away buildings etc and those ugly gsm masts, border lines etc)

I made a small map of the Zeeland province with the default style and --generate-sea=extend-sea-sectors,close-gaps=6000,floodblocker
Without a land-tag it looked ok, after I made some modifications of the typ file. I had to give the sea polygon the lowest draw order.
The new version you can download here: http://mijndev.openstreetmap.nl/~ligfietser/diverse/mapnik.typ_r1946.zip