Map for Adventure Motorcycling using mkgmap and Custom Routable Road 1

First off, I am more than impressed with the work that has gone into OpenStreetMap, mkgmap, and the community contributed content that opens up the Garmin devices to better maps and customizable options! THANK YOU all! I purchased a Garmin Zumo XT motorcycle GPS to use when I am riding my Triumph Scrambler in my state, and I was hoping I could highlight the unpaved roads on the map so I can explore these roads. I also want to contribute the surface type for roads in my area that are incorrect on OpenStreetMap so others can benefit.

Based on information on this site and others, I was able to create a custom IMG file using mkgmap and a modified style that assigns a Garmin type code to unpaved roads. There are two types of unpaved roads that I want to highlight, roads that are unclassified or residential which are typically wide and allow for 2-way traffic, and tracks which are typically narrow and in my experience can indicate a rough road that may be more difficult to ride on. I added this to my lines style:


# highlight unpaved roads that are more than 100m
(highway!=track & highway!=service) &
    (access!=private & access!=no) &
    (motor_vehicle!=no) &
    (surface=gravel | surface=dirt | surface=unpaved | surface=unsurfaced | surface=ground | surface=earth | surface=compacted | surface=fine_gravel) &
    length()>100
    {set mkgmap:unpaved=1} [0x0a resolution 20]

# highlight unpaved tracks that are more than 100m
(highway=track | highway=service) &
    (access!=private & access!=no) &
    (motor_vehicle!=no) &
    (surface=gravel | surface=dirt | surface=unpaved | surface=unsurfaced | surface=ground | surface=earth | surface=compacted | surface=fine_gravel) &
    length()>100
    {set mkgmap:unpaved=1} [0x0e resolution 20]

So far this is working the way I want it to, you can see I am using the Garmin Type Code 0x0a for the unpaved roads and 0x0e for tracks. I want to show them in 2 different custom colors to make them stand out on the map. I added a section to the mapnik.txt TYP file to make 0x0e stand out in bright red, but it doesn’t seem to be working.

[_line]
type=0x0e
;GRMN_TYPE: Custom routable road 2
UseOrientation=N
LineWidth=7
BorderWidth=1
Xpm="0 0 2 0"
"1 c #FF0000"
"2 c #FFFFFF"
String=MADVTrail
ExtendedLabels=Y
FontStyle=SmallFont
CustomColor=Day
DaycustomColor:#FF0000
[end]

I am compiling the IMG file using the command:

java -jar mkgmap.jar -c zumoxt.cfg --input-file=input/map.osm --output-dir=output/ --family-id=1234 typ-files/mapnik.txt

I think the issue is with the way the Zumo XT deals with these elements. I can modify a Garmin style file (xml based .kmtf file) to customize the look of differing lines, but this file doesn’t seem to line up 1:1 with the Garmin Type Codes, especially for a “Custom routable road”. This is what a section of my .ktmf file looks like:


<!-- blue unpaved roads that are publicly accessible -->
<STYLE field="MAP_ROAD_UNPAVED_CLR" scale="1.50"><COLOR><PRIMARY day="#3841fc" night="#3841fc"/><SECONDARY day="#3841fc" night="#3841fc"/></COLOR></STYLE>

From what I can tell, the field MAP_ROAD_UNPAVED_CLR is equivalent to the Garmin Type Code 0x0a, since it is showing those roads in a nice blue:

But the Zumo XT is not picking up the custom style from the TYP file for the red tracks that I want, here you can see the lines that are thick gray are supposed to be red based on the TYP file spec:

So, after this long-winded post, my ultimate question is: How can I get my Custom Routable Road (0x0e) to show up in red like I want? Is there a STYLE field in the .ktmf file that I can add to change the color or am I doing something wrong with the custom TYP file? Thanks in advance for the help, I’m so close to having the perfect GPS!

I can’t say what might be wrong with your style, but I’ve come across some idiosyncracies where the Garmin seems to have a type code hardcoded somehow and you can’t change it. I’ve created a similar modified style for backroads and trails.

I couldn’t figure out how to post an image, so here’s a link to a screenshot.

https://www.dropbox.com/s/veushk41jx9exnz/Screenshot_2020-05-31_14-19-47.png?dl=0

I can share my style code with you, perhaps we could work together to make is better. I’ve almost dropped this project since my Garmin died, but I haven’t found anything better yet, so I’m using the garmin img in Oruxmaps on an Android.

Brad

Rather than editing the TYP with a text file, you could try a visual editor. TYPWIZ 3 is free to use https://www.pinns.co.uk/osm/typwiz3.html

For the map I use on my cycling gps I have a lot of custom line types. https://drive.google.com/file/d/1gIKhmAoJTzJYQjk9xIgOAOX0_Khct0pI/view

It is also possible to use multiple line styles on the same road. For the road in the lower right of my image, it is drawn with regular unclassified style along with a second taller mostly transparent style with a jagged bit to indicate gravel. The gravel style is applied first with

continue with_actions

added after the resolution, so mkgmap continues to apply the normal road style. Bridges are added to maps the same way.

I own Zumo 340, Montana 600 and Nuvi 3790.
I build my own map with custom style.
On Montana map is working, custom style is correctly displayed but on Zumo and Nuvi not.
So Zumo and Nuvi series has hardcoded style. You can only change this by switching themes. You can desing own theme (I assume Zumo XT is using themes too).

Thanks for the help, I’ve managed to fix the issue with the TYP file by specifying in the config the default family-id and product-id, now my custom TYP file is showing up on the Zumo. I’m using the command line:

java -jar mkgmap.jar -c zumoxt.cfg --input-file=input/map2.osm --output-dir=output/ typ-files/mapnik.txt

And my zumoxt.cfg file (config) has these entries:

product-id=1
family-id=6324
family-name="Drrt Finder"
code-page=1252

Based on this I’m using 0x0a for well-maintained dirt roads and 0x10 for smaller dirt tracks. An example of my lines style is:

(highway!=track & highway!=service) &
    (access!=private & access!=no) &
    (motor_vehicle!=no) &
    (surface=gravel | surface=dirt | surface=unpaved | surface=unsurfaced | surface=ground | surface=earth | surface=compacted | surface=fine_gravel) &
    length()>100
    {set mkgmap:unpaved=1} [0x0a resolution 22]

And I have this in my TYP file definition:

[_line]
type=0x0a
;GRMN_TYPE: Roads/UNPAVED_ROAD/Gravel or dirt road/Non NT, NT

UseOrientation=N
LineWidth=5
BorderWidth=1
Xpm="0 0 2 0"
"1 c #CCEEFF"
"2 c #0000FF"
String=MADVUnpavedRoad
ExtendedLabels=Y
FontStyle=SmallFont
CustomColor=No
[end]

This gives me a light blue road with blue borders that stands out well on the map. I colored the tracks a light red with red borders to show narrower dirt roads.


Yes, I’m finding that too! For the life of me I can’t get water name fonts to behave - they look terrible with a blue font and dark thick borders.

Nice, I’ll have to experiment with this. I’m using the continue command to change the display of regular roads as I zoom out (you can see this in the second image). One important note is that the Zumo XT has an extreme amount of zoom capability and a setting in the menu to show “More Detail”. This means that the resolution levels you set to determine what is visible when will have to be increased. For example I make residential roads visible at level 23, and this means I can still see all of them when the scale is set to 0.3 miles.

I was able to get the TYP file working, you can see the difference above in the screenshots I posted. I can also edit the Theme (this is the ktmf XML file) to tweak further, it seems like there are some things that the Garmin ignores from the TYP to pick up from the ktmf. Water is one of those, I couldn’t use the TYP to modify the color so I did it in the ktmf theme file. I am going to keep experimenting.

mark_cushman, could You please share Your current style/typ. I would like to test it on my old Zumo.
At my style I’ve custom point ID’s to show for example fuel stations at higher levels. I can’t achive that using default Garmin id’s.
Unfortunately it’s working only on Montana.
My Zumo theme: https://drive.google.com/file/d/1BeTJRy3ceqz_DA1Tc9nzQup5wkgHhGtL/view?usp=sharing

Yes, give me a day or so and I’ll throw it up on Github with a full build script. :slight_smile:

@mark_cushman I’ve been playing with my Zumo XT as well.

Default Themes set a very small scale for tracks, hence they plot too thin; I’m not aware of a way to set the scale in the type file. As a result of this to properly highlight Tracks you will have to distribute your map with a .ktmf theme as well

Did you get to the same outcome?

Ok, I’ve put my build up on GitHub here: https://github.com/markcushman/motomap

I modified the style in the lines file to use the 0x10 type which is a routable road:

# motomap - flag tracks that are more than 100m
(highway=track | highway=service) &
    (access!=private & access!=no) &
    (motor_vehicle!=no) &
    (surface=gravel | surface=dirt | surface=unpaved | surface=unsurfaced | surface=ground | surface=earth | surface=compacted | surface=fine_gravel) &
    length()>100
    {set mkgmap:unpaved=1} [0x10 resolution 22]

And then in my typ file I do this:

;motomap - trails show up in red
[_line]
type=0x10
;GRMN_TYPE: Custom routable road 1 (Unpaved Track-thin)
;UseOrientation=N
LineWidth=4
BorderWidth=1
Xpm="0 0 2 0"
"1 c #FFFFFF"
"2 c #FF0000"
String=Motomap Trail
ExtendedLabels=N
FontStyle=SmallFont
CustomColor=No
[end]

Actually works out quite well. I’ve deleted most of the entries in the .kmtf theme, only left very few when I can’t get the typ file to do what I want.


    <STYLELIST>
      <STYLE field="MAP_MISC_WATER_AREA_CLR"><COLOR><PRIMARY day="#AAD3DF" night="#162e3f"/></COLOR></STYLE>
      <STYLE field="MAP_WATER_CLR"><COLOR><PRIMARY day="#AAD3DF" night="#162e3f"/></COLOR></STYLE>
    </STYLELIST>

I had a nice mkgmap style that worked well for my Garmin Montana. Unfortunately that device died so I replaced it with a Zumo XT. The map that worked on the Montana, and works on Qmapshack, does not work on the Zumo. Many of the roads and trails don’t show up. What a PITA. Evidently many of the type codes are not recognized. This is what I found:
Doesn’t work: 0x2c, 2f, 10101, 2d, 33
Works: 0x2a, 02, 01, 13
Mark, My style is motivated by adventure/dual sport motorcycling too. I have distinct types for these roads/trails (in addition to the standard highway types)
paved
unpaved good
high clearance (smoothness=very_bad)
4wd (smoothness=horrible or 4wd_only=yes)
motorcycle trails
ATV trails
nonmotorized trails.

A screenshot from the Zumo
https://www.dropbox.com/s/yl78sw18jnez9u7/74542.png?dl=0

Brilliant, and thanks for doing this and sharing.
Where should i put --latin1? Thai names comes out very strange without this string.
Support for osm.pbf ? http://download.geofabrik.de

I just updated the Github package to enable support for Geofabrik osm.pbf files
Sorry, I don’t yet know how to enable Unicode or other character sets - I’ve been digging but haven’t found a solution.

https://github.com/markcushman/motomap

In case you don’t know how to enable it in mkgmap: Search for “Label options” http://www.mkgmap.org.uk/doc/options

Thanks! I did try once with --code-page=65001 which is Unicode but my GPS (Zumo XT) wouldn’t load the map (said it was corrupted). I’ll have to experiment with other 8-bit character sets as needed, I guess.

Experiment with code-page=XXXX in motomap.cfg. Maybe try 874?

https://docs.microsoft.com/en-us/windows/win32/intl/code-page-identifiers

Just a note that I’m now hosting pre-built .img files with this theme at http://motomap.org/. US and Canada only for now.

Hi All, I was just sent a link this thread by a user of mine who has a Zumo XT that is giving him problems with some custom maps (.img files) that I create. I also have other XT users that are seeing weirdnesses that I have yet to explain. I have not fully grokked all that has been discussed here - I’m hoping it might help me to a solution to my XT issues. I’m introducing myself here to let you know I have spent a lot of time writing a free toolkit that takes GPX track files and converts them to custom garmin maps. Off-road (and sometimes street) motorcycle riders use these maps to better see where we are going in difficult riding conditions (severe vibration, dust, poor lighting, no roads to tracks on maps, etc.). I invite all of you to explore what I have done for anything you can use it for. If you have ideas, suggestions, etc. I’m always open to that. Like I said, all I have is free to use as my “give-back” to the off-road community (or anyone else who wants to use it.) My website is a bit hokey because I don’t want to spend time on it. It’s functional and that’s all I care about. Here’s a small example of what my “fat” lines with “targets” (waypoints on steroids) looks like… Oh, for some reason I can’t embed an image (maybe I don’t have enough cred to to that here yet?). Here’s the website and here are some short youtube vids that give you the idea of what it looks like and how it works.

https://www.tricktracks.org/

https://www.youtube.com/playlist?list=PLAfSC_jBvt8CuSCwiOnx18VdtpiI8gTrW