OpenStreetMap Forum

The Free Wiki World Map

You are not logged in.

Announcement

A fix has been applied to the login system for the forums - if you have trouble logging in please contact support@openstreetmap.org with both your forum username and your OpenStreetMap username so we can make sure your accounts are properly linked.

#1 2010-11-18 11:36:05

ligfietser
Moderator
Registered: 2008-10-09
Posts: 4,554
Website

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/ … our-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/~ligfie … mapnik.TYP

The results can be seen here:

mapnik_mapsource.jpg?height=193&width=400
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/~ligfie … oolkit.jpg

Last edited by ligfietser (2011-02-12 11:33:28)

Offline

#2 2010-11-18 15:37:04

csdf
Member
From: UK, living in Abu Dhabi
Registered: 2009-08-11
Posts: 313
Website

Re: Mapnik layout (TYP file) for Garmin osm maps

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).

Offline

#3 2010-11-18 16:09:02

ligfietser
Moderator
Registered: 2008-10-09
Posts: 4,554
Website

Re: Mapnik layout (TYP file) for Garmin osm maps

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

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

or

2)
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?

Offline

#4 2010-11-18 20:19:14

wilpin
Member
Registered: 2009-11-22
Posts: 71
Website

Re: Mapnik layout (TYP file) for Garmin osm maps

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.

Last edited by wilpin (2010-11-18 20:20:54)

Offline

#5 2010-11-18 22:45:54

ligfietser
Moderator
Registered: 2008-10-09
Posts: 4,554
Website

Re: Mapnik layout (TYP file) for Garmin osm maps

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

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

Offline

#6 2010-11-19 10:50:42

csdf
Member
From: UK, living in Abu Dhabi
Registered: 2009-08-11
Posts: 313
Website

Re: Mapnik layout (TYP file) for Garmin osm maps

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

Offline

#7 2010-11-19 12:12:20

ligfietser
Moderator
Registered: 2008-10-09
Posts: 4,554
Website

Re: Mapnik layout (TYP file) for Garmin osm maps

csdf wrote:

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.

Offline

#8 2010-11-19 13:10:45

csdf
Member
From: UK, living in Abu Dhabi
Registered: 2009-08-11
Posts: 313
Website

Re: Mapnik layout (TYP file) for Garmin osm maps

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

Offline

#9 2010-11-19 13:50:57

ligfietser
Moderator
Registered: 2008-10-09
Posts: 4,554
Website

Re: Mapnik layout (TYP file) for Garmin osm maps

csdf wrote:

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.

Offline

#10 2010-11-29 22:29:55

GPS-Mic
Member
Registered: 2010-08-17
Posts: 11

Re: Mapnik layout (TYP file) for Garmin osm maps

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!

Offline

#11 2010-11-30 09:44:41

ligfietser
Moderator
Registered: 2008-10-09
Posts: 4,554
Website

Re: Mapnik layout (TYP file) for Garmin osm maps

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.

Offline

#12 2010-11-30 18:54:28

GPS-Mic
Member
Registered: 2010-08-17
Posts: 11

Re: Mapnik layout (TYP file) for Garmin osm maps

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.

Offline

#13 2011-03-26 16:16:25

Oldy2
Member
From: Velp Gld (NL), Tíszafüred (HU)
Registered: 2011-03-26
Posts: 1

Re: Mapnik layout (TYP file) for Garmin osm maps

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

Offline

#14 2011-04-22 21:54:52

ligfietser
Moderator
Registered: 2008-10-09
Posts: 4,554
Website

Re: Mapnik layout (TYP file) for Garmin osm maps

csdf wrote:

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).

I have found a trick to make the spaghetti lines more bearable ;-)  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:
spagj.png
without overlay
nospag.png
with overlay 0x10106

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

127b.png

Last edited by ligfietser (2011-04-22 22:02:11)

Offline

#15 2011-04-23 07:10:43

csdf
Member
From: UK, living in Abu Dhabi
Registered: 2009-08-11
Posts: 313
Website

Re: Mapnik layout (TYP file) for Garmin osm maps

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.

Offline

#16 2011-04-23 09:00:18

ligfietser
Moderator
Registered: 2008-10-09
Posts: 4,554
Website

Re: Mapnik layout (TYP file) for Garmin osm maps

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/openfietsm … 22-04-2011

Offline

#17 2011-04-23 21:25:32

Beddhist
Member
From: Glenbervie, NZ
Registered: 2009-07-28
Posts: 344
Website

Re: Mapnik layout (TYP file) for Garmin osm maps

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

ligfietser wrote:
csdf wrote:

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.

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.

Offline

#18 2011-05-24 18:48:44

Lambertus
Administrator
From: Apeldoorn (NL)
Registered: 2007-03-17
Posts: 3,269
Website

Re: Mapnik layout (TYP file) for Garmin osm maps

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'?


Mapping tools: Garmin GPSmap 60CSx, Giant Terrago 2002

Offline

#19 2011-05-24 20:53:49

ligfietser
Moderator
Registered: 2008-10-09
Posts: 4,554
Website

Re: Mapnik layout (TYP file) for Garmin osm maps

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)

Offline

#20 2011-05-24 22:48:55

ligfietser
Moderator
Registered: 2008-10-09
Posts: 4,554
Website

Re: Mapnik layout (TYP file) for Garmin osm maps

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/~ligfie … _r1946.zip

Last edited by ligfietser (2011-05-24 22:49:19)

Offline

#21 2011-05-25 09:01:16

Lambertus
Administrator
From: Apeldoorn (NL)
Registered: 2007-03-17
Posts: 3,269
Website

Re: Mapnik layout (TYP file) for Garmin osm maps

Cool, thanks!


Mapping tools: Garmin GPSmap 60CSx, Giant Terrago 2002

Offline

#22 2011-05-26 14:53:13

g0ldfish
Member
Registered: 2009-04-27
Posts: 288

Re: Mapnik layout (TYP file) for Garmin osm maps

Looking around through several available styles in order to find what works best for me, I noticed that the definition for 0x08 (minor ramp) is skipped, so these ramps would be displayed whatever the default is on the given device. 

The default mkgmap style uses this both for primary and secondary links. I would suggest to set it to the color of secondary highways, as in my opinion a primary road with a "lower class" ramp/link looks more plausible than a secondary with a "higher class" ramp/link.

Offline

#23 2011-05-26 16:19:10

ligfietser
Moderator
Registered: 2008-10-09
Posts: 4,554
Website

Re: Mapnik layout (TYP file) for Garmin osm maps

g0ldfish, I've added your suggestion, see
http://mijndev.openstreetmap.nl/~ligfie … _r1946.zip

Offline

#24 2011-07-31 08:56:19

ligfietser
Moderator
Registered: 2008-10-09
Posts: 4,554
Website

Re: Mapnik layout (TYP file) for Garmin osm maps

Beddhist wrote:
ligfietser wrote:

If you use a typ file by default it won't be a problem, then we can use overlays to distinguish those roads and add even more features, like tracktype (1-5) cyclelanes etc etc

I don't know whether Lambertus wants to use a typ by default and I also don't know whether it's a good idea to force it onto people. On the other hand, we should be able to force mkgmap to correctly translate lanes and walkways. In my way of thinking we should set things up so that the style will render the map as correctly as possible without a typ, which can then be used for enhancements.

Should we move this discussion into a new topic?

Cheers,
Peter.

Another option is to send the maps by default with a typ file (which is empty) like the emtpy.typ in http://mijndev.openstreetmap.nl/~ligfie … _r1946.zip
and a mapnik one (and maybe some others) as well, so someone can simply rename emty.typ (or default.typ) by one of those others.

Offline

#25 2011-07-31 09:04:19

Beddhist
Member
From: Glenbervie, NZ
Registered: 2009-07-28
Posts: 344
Website

Re: Mapnik layout (TYP file) for Garmin osm maps

Now that's a great idea, although it will mean that you need to maintain several typ files and keep them in sync.

Offline

Board footer

Powered by FluxBB