Roland's homepage

My random knot in the Web

Installing Openstreetmap data on a Garmin zūmo 340LM

This documents how you can install openstreetmap data on the Garmin zūmo 340 LM. This procedure probably also works on other Garmin devices, but I haven’t tested that. The commands listed in this article assumes you’re using a UNIX-like operating system. While most of the actions could be performed on ms-windows, I haven’t run that in decades, so I’m not the person to give advice about that

Why

Note

This is not about the costs of the map data from Garmin. I would have gladly paid for the map if it were not for the inconvenience of the process for me as someone who doesn’t use ms-windows.

Garmin basically only supports buying and installing updated maps via its “garmin express” software. This program is available for ms-windows and mac OS X. Since I use neither, I would have to;

  • Install an emulator like qemu, configuring it to use USB-redirection.
  • Install windows on it (which can only be used for 30 days, unless you activate it. It makes no sense to buy an ms-windows license for this.)
  • Download and install garmin express.
  • Create a garmin account.
  • Purchase a map.
  • Install the map.
  • Save the account data and purchased map data for the next time I need it.

This is just too much hassle.

There has to be an easier way. And it turns out that there is.

What

The img map format that Garmin uses has been largely reverse-engineered. There are several maps for garmin devices based on openstreetmap data available. After reading the relevant wiki page, and browsing the available alternatives, I chose to use Freizeitkarte.

I downloaded the Dutch language maps for the Netherlands and Belgium from this page.

Of note

These openstreetmap based map files do not contain the data that enables the zūmo to show lanes and traffic signs near an exit.

While that was a nice feature, the traffic sign information was the first thing to go stale. I started noticing differences between the real signs and what was shown on the zūmo almost immediately. It took much longer before new and changed roads and intersections became noticable.

Navigating without the traffic signs works fine for me so far.

Hardware preparations

By default, my zūmo 340LM starts up in MTP mode. This doesn’t work in combination with my computers using FreeBSD UNIX. I get a lot of errors like these:

uhub_reattach_port: could not allocate new device
usb_alloc_device: set address 6 failed (USB_ERR_IOERROR, ignored)
usbd_setup_device_desc: getting device descriptor at addr 6 failed, USB_ERR_IOERROR
usbd_req_re_enumerate: addr=6, set address failed! (USB_ERR_IOERROR, ignored)
usbd_setup_device_desc: getting device descriptor at addr 6 failed, USB_ERR_IOERROR
usbd_req_re_enumerate: addr=6, set address failed! (USB_ERR_IOERROR, ignored)
usbd_setup_device_desc: getting device descriptor at addr 6 failed, USB_ERR_IOERROR
usbd_req_re_enumerate: addr=6, set address failed! (USB_ERR_IOERROR, ignored)
usbd_setup_device_desc: getting device descriptor at addr 6 failed, USB_ERR_IOERROR
usbd_req_re_enumerate: addr=6, set address failed! (USB_ERR_IOERROR, ignored)
usbd_setup_device_desc: getting device descriptor at addr 6 failed, USB_ERR_IOERROR
ugen0.6: <Unknown > at usbus0 (disconnected)

After some online searching, it seems the device has to be put in mass-storage mode.

  • Go to the trip computer screen by pressing the menu key (“≡”) on the bottom right of the map.
  • Press the speed for about five seconds, until the “Diagnostics Page” menu appears.
  • Scroll down to “MTP settings”.
  • Choose “Mass Storage” and save the setting.

If you plug in the device to your computer after this, it should become visible as a direct access device that can be mounted.

The confusion about map locations

Sources often don’t agree where the Garmin device expects maps to be. It is likely that this has also changed over the different GPS models.

The sources often speak of placing additional maps in the Garmin folder on an SD card. However, my zūmo 340LM doesn’t contain an SD card. It doesn’t detect maps placed in the Garmin folder of the device itself. Incidentally, the maps that the device came with, called gmapbmap.img and gmapprom.img are in the (hidden) .System folder. But placing additional maps there also doesn’t work. We are however about to discover why.

The GerminDevice.xml file

In the Garmin directory on the device, there is a file called GarminDevice.xml. Knowing that XML files are plain text and are often used for configuration purposes made me have a look at it.

It contains an identifier for the device (presumably the serial number), a registration code, several unlock codes and other configuration data. One fragment of the XML file especially caught my eye.

<DataType>
  <Name>SupplementalMaps</Name>
  <File>
    <Specification>
      <Identifier>IMG</Identifier>
    </Specification>
    <Location>
      <Path>Map</Path>
      <BaseName>gmapsupp</BaseName>
      <FileExtension>img</FileExtension>
      <Extensions>
        <dtlx:DataTypeLocationExtension>
          <dtlx:ExternalPath>Garmin/</dtlx:ExternalPath>
        </dtlx:DataTypeLocationExtension>
      </Extensions>
    </Location>
    <TransferDirection>InputOutput</TransferDirection>
  </File>
</DataType>

From this I gather that for the zūmo 340LM:

  • Supplemental maps on the device should be in the directory Map. (This doesn’t exist; I had to create it.)
  • On an SD card, they should be in the directory Garmin.
  • The name of supplemental maps should contain or begin with gmapsupp, and end with .img.

Note that these values could be different for other Garmin devices! Look at the GarminDevice.xml file on your device, and adjust accordingly.

From one of the other sources I learned that newer devices can have more than one supplemental map.

Installing the maps on the device

First, we plug the device (on mass storage mode) into the computer. Then we mount the device that appears.

# mkdir /mnt/garmin
# mount_msdosfs -m 644 -M 755 -o noatime /dev/da1 /mnt/garmin

(This mount command is for FreeBSD; it could be different on Linux and other UNIX variants.)

Then we make a backup of the device data first, just to be sure. Below, a “#” in front of a command indicates that it should be executed as the root user. A “>” indicates that the command can be carried out by an unprivileged user.

# cd /mnt/garmin
# tar czf /tmp/zumo-backup-20211011.tar.gz .

Now we unpack the zip-files containing the map data, rename them because both the map data have the same name, and install them.

> cd ~/tmp/
> unzip NLD_nl_gmapsupp.img.zip
Archive:  NLD_nl_gmapsupp.img.zip
  extracting: gmapsupp.img
> mv gmapsupp.img gmapsupp_NLD.img
> unzip BEL_nl_gmapsupp.img.zip
Archive:  BEL_nl_gmapsupp.img.zip
  extracting: gmapsupp.img
> mv gmapsupp.img gmapsupp_BEL.img
# mkdir /mnt/garmin/Map
# cp gmapsupp_* /mnt/garmin/Map/
# sync
# umount /mnt/garmin
> rm *.img

After rebooting, the additional maps show up on the device, and can be selected. Note that the map is identified by the internal name from the map file. These are shown below:

> hd -s 0x49 -n 17 gmapsupp_NLD.img
00000049  46 72 65 69 7a 65 69 74  6b 61 72 74 65 5f 4e 4c  |Freizeitkarte_NL|
00000059  44                                                |D|
0000005a
> hd -s 0x49 -n 17 gmapsupp_BEL.img
00000049  46 72 65 69 7a 65 69 74  6b 61 72 74 65 5f 42 45  |Freizeitkarte_BE|
00000059  4c                                                |L|
0000005a

(The hd command is also known as hexdump.)


For comments, please send me an e-mail.


←  Add TeX macro around (visual) selections in Vim De-facebook your internet  →