|
Guide to TYP files
Concept
Garmin GPS devices (and Garmin's MapSource) have a lot of inbuilt styles for POIs, lines and polygons. You can get a partial list of what these look like by looking at my spreadsheet (see here, last link on this page). Or you can see the partial list on the openstreetmap wiki.
If you would like to change what a certain element in your map looks like, you have two options:
- Use a different Garmin type code for that element; or
- Use a TYP file to re-define how that specific Garmin type looks
If you chose option 1, you can skip this page, but you'll need to know what different Garmin type codes look like. For a partial list, download my spreadsheet or take a look at the other sources of info listed here. Be aware that different Garmin type codes are allocated to different categories by MapSource and by Garmin GPS units. So you may select type code 0x640c (say) for traffic lights, but then find that this is categorised by your GPS unit under the Cafes/Bars POI category.
If you chose option 2, then read through the rest of this page.
Where do I start?
Probably the easiest thing to do is to take an existing TYP file and change it to suit your needs. I would suggest that you download my CFMaster.TYP file and use that to follow the examples on this page. For more on what this file is, see my downloads page.
Be aware that a TYP file is a customisation that is designed to work with a particular mkgmap style - if you apply someone else's TYP file to your own style, you may not get the results you expect. If you are going to use my TYP file, you will also need to download and use my style file. As discussed elsewhere on my site (see question 9), I maintain and use two styles - one for my old GPS which can't display borders on roads, and one for Mapsource which can. The link I've just given is to my Mapsource style, which I will use for the following examples. |
Now visit http://ati.land.cz/gps/typdecomp/editor.cgi and use it to open and see this TYP file. (You could also try using TYPViewer as an alternative). You will see that the TYP
file is split into different sections: ways, polygons and then POIs. Within the polygon section, elements are ordered by drawing order, with a lower drawing order number (e.g. 1) meaning that something is drawn first (in the GPS) than a higher drawing order number (e.g. 4). Lines and POIS do not have a drawing order (see here for more details on how your GPS or MapSource decides what order to draw areas, lines and POIs).
To edit the file, just click the `edit' button by any element. Different elements have different edit methods, but it's all pretty point-and-click, so I won't give any specific directions.
Once you have made all the changes you want, download the updated TYP file using the buttons at the bottom of the page.
Caveats
- One thing to point out: the TYP file doesn't have to cover every element you want eventually want to display. If you are happy with the default style of a given element, don't bother defining it in the TYP file, just leave it out. This way, the TYP file should only contain elements that you want to appear differently to the default style.
- At the very top of the TYP editor, you will see that you can set the family ID of your TYP file. Internet lore suggests that the family ID of the TYP file must be the same as the family ID of the map you want to apply it to. For instance, my master TYP file has family ID 1500 and I generate identical copies of this file with different family IDs to match all the different maps I have installed in Mapsource.
Some worked examples of neat things to do with a TYP file
Add one-way arrows to one-way roads
- The aim here is to add arrows to one-way roads, so you can differentiate them from dual-way roads.
- Edit the TYP file to include blue arrows. You can either use my TYP file or create your own. If you open my TYP file in the online editor you can see that I have set the blue one-way arrows to Garmin type 0x1050e.
- The next step is to update the lines style file to add rules for oneway arrows. This example is for residential roads, but you can extend this to other roads too.
highway=residential & oneway=yes [0x10013 resolution 24 continue]
highway=residential & oneway=yes [0x1050e resolution 24]
|
This tells mkgmap to first create a road (0x10013) whenever it encounters a highway=residential OSM object, then continue and apply the next rule, which is to add the oneway symbols (0x1050e).
- And this is the result:
Note that Mapsource has plotted the oneway symbols underneath the road. This is an unavoidable feature of Mapsource...the draw order of superimposed lines is impossible to control and not yet understood by the mkgmap developer team. However, if you use this same system on your GPS, you will find that the oneway symbols plot on top of the road, as you would expect.
Add visual indicators for bridges
- The aim here is to add a thin black border to bridges, to differentiate them from ordinary roads. The example is going to be for a trunk road, but again you can extend this to whichever roads you like.
- Add the following rules to the lines style file:
highway=trunk & bridge=yes [0x10101 resolution 24 continue]
highway=trunk [0x10008 resolution 24]
|
- If you examine these two objects in the TYP editor, you will see that 0x10101 is the bridge, and 0x10008 is the trunk road:
- Here's what the end result looks like in MapSource:
Add traffic light symbols
- The objective is to display traffic lights wherever they exist in the OSM data.
- Firstly, we make sure that a traffic light symbol is defined in the TYP file. In CFMaster.TYP, this is Garmin object 0x7010:
- Next, we add an appropriate rule to the points style file:
highway=traffic_signals [0x7010 resolution 24]
|
- And this is the result:
How do I combine the TYP file with a map?
Save the TYP file that you generated above. Now compile your map using mkgmap as usual, but add the name of the TYP file to the end of the set of commands for mkgmap. For instance:
java -jar mkgmap.jar --gmapsupp --style-file=mystyle -c template.args CFMaster.TYP |
It's
as simple as that. The resulting gmapsupp.img file will contain both
the map data, and the map style defined by CFMaster.TYP. If you open the
gmapsupp file using sendmap (see FAQ), you will see both the map tiles and the TYP file listed.
|