Creating IMG from GPX (Newbie Question)

I have been playing around with mkgmap - trying to learn how it works and what various options do. My ultimate goal is to make maps to load onto my Garmin Oregon and other Garmin GPS units.

I wanted to see how/if I could create an IMG file from some tracks that I recorded with my GPS unit. The tracks are in gpx format.

I performed the following steps:

  1. Converted gpx file to osm file in GPSBabel (I tested whether this worked by trying to open osm file in JOSM and was told that an error occurred (with a reference to the line in the osm file that was a problem) because the version of osm (0.5) created by GPSBabel was not supported - a goggle search suggest that I manually go into the osm file and change the version reference to 0.6 - I did this and was able to view the osm file in JOSM).

  2. Ran mkgmap with the following command:

IMG files and a TDB file was created, but when I loaded the map into either BaseCamp or Qlandkarte, no map was visible. Before adding “–transparent”, a the map showed as an empty box on Qlandkarte; and after adding “–transparent” nothing showed up.

I then found this discussion http://gis.19327.n5.nabble.com/creating-garmin-map-layer-from-gpx-tracks-td5719632.html. Following ligfietser’s suggestion I downloaded IMGfromGPX and was able to create a IMG that I could view in Qlandkarte (note, I had to use GMAPTool to create TDB files for Qlandkarte). Although when I ran IMGfromGPX I did receive the following error to the effect that there was a “NilObjectException in module wProgress.GetMapName”. Not sure what this means (goggled it, but didn’t find anything helpful), but map loaded into Qlandkarte.

My question is, shouldn’t I be able to create the IMG using mkgmap withour needing to use IMGfromGPX? What am I doing wrong? I am asking this for learning purposes - so that I can better understand how to use mkgmap. Any help would be appreciated.

Thanks!

When you used GPSBabel to convert to a track to .osm format, it will create a way, but without any tags. You need to add tags, so specify what sort of way it is. eg to say if it is a road or river or railway etc.
Mkgmap needs some tags, so it knows what sort of objects to create in the Garmin map.

There is an option in GPSBabel to add OSM tags. If you are using the GUI, click the button for “Options” in the Output section. Then tick the box for “Write additional way tag key/value pairs”, and type in the tag you want. Note it has to have a colon in between the tag and value. eg highway:primary or waterway:river etc.
Or you can add tags in JOSM, or by editing the .osm file in a text editor.

Thanks for the reply, Vclaw.

I did add a tag in GPSBabel. I added tag=“highway:path”. Should I have omitted the quotes?

Also, in the GPSBabel GUI the is a section for “Transcription” option and you can check one or more of “Waypoints”, “Tracks” or “Routes” - by default all are checked - I left “Tracks” checked and unchecked the others. Was that correct?

FWIW, after running GPSBabel a preview of the ism file is shown in a google earth pop up. In my case the ism seemed be properly displayed - at least as far as geographic location.

You don’t need gpsbabel to convert gpx to osm format, you can load a gpx file in josm and convert it to ways in the data layer (dont know the exact command for this) and save it as osm file. Of course those ways need to have valid osm tags like vclaw says and you can use josm for this. If you dont use valid osm tags this is also possible but then you have to use custom mkgmap style rules.

A very good mkgmap tutorial to learn it step by step can be found here: http://www.cferrero.net/maps/maps_index.html

Thank you, Ligfietster.

I just recently downloaded JOSM. I will spend more time with it.

I read thru the tutorial you referencesd several weeks ago when I first started investigating mkgmaps. I will read thru it again.

As an update, I again tried GPSBabel to convert the gpx to osm - but this time I left all of the boxes checked in the “Translation” options section and did not put quotes around the tags.

When I ran the resulting osm file thru mkgmaps, everything worked as expected. Except that in Basecamp the resulting map seemed to be missing its top right and lower left corners. Still usable, but I thought that odd? Note, I didn’t notice this in Qlandkarte, but that might just be due to the background color of the canvas in Qlandkarte.

I am been playing around with JOSM, but cannot seem to figure out how to convert gpx → ways → osm…very steep learning curve. But I will keep working at it. [UPDATE – I FIGURED THIS OUT – RIGHT CLICK ON GPX LAYER AND SELECT CONVERT TO DATA LAYER]

Can anyone point me to some information on how to make layered maps with mkgmap?

Thanks again.