Questions about TYP files and styles

I have a question about TYP files and styles, several questions actually. I always download the OSM_generic_new_style maps for my areas of interest, Thailand, Alaska, New York State, etc., and in general I like the way features and POIs are rendered. However there are several things I’d like rendered differently. Tertiary and unclassified highways for starters, amenity=place_of_worship with religion=buddhism, for another. And there are a quite a few more. I have done extensive reading in this forum, in various OSM wikis, and elsewhere and have run into problems with both my understanding and in the results I’ve been able to achieve…

I have successfully compiled and created maps with mkgmap and have been using TYPViewer to inspect and modify TYP files. But it seems the slightest change I make in a TYP file has effects that are unintended. For example, I would like to see tertiary highways rendered in color so as to make them stand out better. The base TYP file I’ve been working with is the one that comes along with the Thailand country download from the Lambertus site, 24983.TYP. I edited this TYP file with TYPViewer and since tertiary highways are not included in the 24983.TYP file I added a polyline of type 0x005, made it 4 pixels wide and chose a pale yellow color with grey border. I determined the type code for highway=tertiary by inspecting some other TYP files I found in various places on the Internet. At first glance my maps looked much better than the standard ones. Then I noticed that bridges are no longer visible in my compiled maps, neither in Basecamp nor on my Montana GPSr. Obviously, being a mapper, bridges are something I want to see on the GPS while traveling. I noticed too that with the standard unmodified 24983.TYP, bridges show on my Montana but not in Basecamp.

Why do bridges disappear in maps with my customized TYP file? Furthermore, why do bridges show up on my Montana and not in Basecamp with the standard TYP file?

It is also possible to tell mkgmap to use styles found in a user-specified style-file. If you do not specify a style-file, the default or built-in line styles are used. They include this directive:

highway=tertiary [0x05 road_class=1 road_speed=3 resolution 20]

Does this style interact with the settings in a TYP file and if so how? The polyline I added is type 0x005 but all of these have one less zero, 0x05. What is the difference?

In general, why would one use styles as opposed to TYP files to control rendering?

The default mkgmap line styles also include these statements:

highway=unclassified [0x06 road_class=0 road_speed=3 resolution 21]
highway=living_street [0x06 road_class=0 road_speed=1 resolution 22]
highway=residential [0x06 road_class=0 road_speed=2 resolution 22]

I know the OSM_generic_new_style maps render living_streets differently. Given the above, how is that accomplished?

I would like to make highway=unclassified a different color in my maps but the 24983.TYP file does not include a polyline type 0x06. After the problems I had when adding the type 0x005 I want to learn more before proceeding. The OSM_generic_new_style maps render unclassified, residential and tertiary highways the same way.
Is this because the styles are practically identical? Moreover, do the OSM_generic_new_style maps use styles at all?

In addition there is this other default style that is of type 0x06 as well except that it is a road_class=1.

highway=minor [0x06 road_class=1 road_speed=3 resolution 21]

*What exactly is road_class in the above directives? Is road_class more properly called a sub-type?
*

The info that is scattered here and there on the Internet is not organized well and does not begin to present a comprehensive picture of how this all works together. To make matters worse, much of the data specific to Garmin GPSr units is outdated and talks about Mapsource, a product that is no longer being maintained or updated.

I know there is a lot of expertise available in this forum. Could someone please take the time to explain how these various pieces fit together? If I can get answers to the questions I posed above, that will be a big start. Some of my questions are specific to the maps from Lambertus, which is why I started here but maybe I should post this question on the main Garmin forum page?

Thanks in advance for your time…

Cheers,
Dave

PS: The command line I’m using to compile the maps is here:

java -Xmx1000m -jar mkgmap.jar --latin1 --family-id=24983 --name-tag-list=name:en,int_name,name --gmapsupp --description="North-TH" --country-name=THAILAND
 --country-abbr=TH --index --location-autofill="is_in,nearest" --copyright-message="ODbL by OSM contributors" --link-pois-to-ways    --reduce-point-density=4
--reduce-point-density-polygon=8 --merge-lines --route --drive-on-left --check-roundabouts --check-roundabout-flares --nsis --process-destination --poi-address
north-th.osm 24983.TYP

First, you need to use the Generic new styles style sheet from here:
https://code.google.com/p/mkgmap-style-sheets/source/browse/#svn%2Ftrunk%2Fstyles%2Fworld
This is very important because the built-in mkgmap style sheet is different and does not render bridges.

The code for the bridge you can find in the lines file:

# bridges & tunnels
bridge=* & bridge!=no & highway!=proposed & bridge!=proposed & railway!=proposed [0x2b resolution 24 continue with_actions]
(tunnel=yes | tunnel=true | tunnel=1) & highway!=proposed & railway!=* & waterway!=* [0x2a resolution 24 continue with_actions]

You have to make adjustments to the bridge type (0x2b) if you make the tertiary road wider.
Also Basecamp renders it different than your GPS so some features will show up differently.
It is a matter of trial and error, if your Montana can render it, doesnt mean it will render on every other Garmin the same.
This is a very annoying issue for the map maker :open_mouth: it would be much easier if Garmin produced their units more consistent.

See above, you have to use the custom style sheet, not the built in.
For tertiary highways it doesnt matter because the code is the same (0x05 of 0x005).
It is the same hex code, but typ viewer adds another zero to it, but sometimes leaves that zero out as well, so I agree it is very confusing.

They both control the rendering, the styles convert the osm code to garmin img code, the typ file renders the img code to a more pleasant image.

You can add 0x06 to the typ file the same as you did for 0x05.
The new styles use the default Garmin rendering so this isnt specified

Please have a look at the mkgmap style manual http://www.mkgmap.org.uk/doc/index.html

Mapsource is still working though, I use it more than Basecamp.

You have to specify the custom style e.g. --style-file=world from the mkgmap-style-sheets site

Awesome, ligfietser, thank you so much for your detailed reply. I think I will be able to make sense of this stuff now.

I will grab the style sheet and incorporate it in my mkgmap command.

I’m sure I will have more questions later because I want to add rendering for a custom style and icon for Buddhist temples (and a few other things) but you’ve given me a huge boost with this.

Cheers,

Dave

You’re welcome Dave,
Once you are familiar with adding new icons, you can help improving the new style rendering :slight_smile: