Hi All,

A maps in the Garmin proprietary formats are available in a wide variaty of the distribution forms. For instance, there are a maps, which are ready to use on a Garmin GPS device. Typically, that maps are packaged in a single file, gmapsupp.img. Beside of that, Garmin provides free desktop applications such as BaseCamp and a maps intended for use with that applications can be packaged differently. So the installation procedure for that maps also can be different. Usually it's non a problem to start using a commercial map for BaseCamp because it comes with some kind of user's manual.

But the Garmin format is quite popular now and a lot of free maps are available thanks to the open initiatives like OSM and SASGIS. A well known common feature of the open source guys is that they'd learned from each other to hate documentation. Therefore, a drops from them can be difficult to use because of long learning curve. The map products are not an exception. No theory of operation is provided, so if something went wrong (not a rare event) a user have to waste a lot of time surfing over a spreadings of faqs, wikis, forums, etc., etc., just to figure out how it supposed to work and what to do with that "free" package. Anyway I'm not aware of a document discussing the installation of such maps with more-less enough coverage level.

So this is my attempt to create something that provides a user with a general idea about how to start using a free map of the Garmin format on a Windows machine (I'm not a Mac user, sorry). That is, how to install, to register, to stage, to import (the right word depends on street and town) a free map package. Also it helps to realize how to remove a map when it's no more needed.

Actually it's a digest of information collected from known web sites such as javawa.nl and from a lot of other great places (like that forum, btw). I think it'll be useful for those still preferring conventional from-top-to-down learning approach.

Your notes are welcomed

---

A Garmin map distribution package for desktop application is a collection of multiple files (a map set). In the table below you will find a description for those relevant to the matter:

File type
File ext.
Presence
Description
Tile data base .tdb Mandatory This is an index file that is used by MapSource and BaseCamp to decide which map segments have to be rendered on the screen or loaded to a GPS device. MapSource/BaseCamp uses this information to decide which .img files belong to the map. When one or more is missing, the map cannot be processed.
Base map .img Mandatory Contains a simplified overview map, which is used when you zoom out.
Map segment (tile) .img Mandatory Every map contains at least one of them, but usually a lot more. Each of them have a unique name consisting of 8 digits and the extension .img
MDR .img Optional Contains a search index. Will be used when you search in the application for e.g. an address, city or POI.
MDX .mdx
Optional
This is a kind of search index too, but this one describes the relations between the regional maps.
TRF .trf
Optional
Contains a data related to the road traffic information service provided over RDS/TMS network. Commonly seen in City Navigator maps
TYP .typ
Optional
This file contains the style information used for the display of the map elements. It controls the view of map elements and is divided into:
- POI: symbols for churches, schools, etc.
- Poly lines: lines for road, contour lines etc.
- Polygons, area fill pattern for rivers, orchards, etc.
Notice .txt
Optional
Contains a utf-8 text for displaying in the Notice pop-up window of the Map Product Manager in BaseCamp/MapSource application. Usually it's an end user license agreement text

Currently, the two methods of mapset registration with MapSource or Basecamp application are known (beside on-line updating). The first method requires a map-specific installer software tool (comes with a map package). This method was designed for importing a maps to MapSource but BaseCamp also recoginzes a maps registered by that method, in order to maintain backward compatibility. While the second method, which was designed later, does not require any additional tool. To register a mapset, user just have to place the map package contents in the appropriated directory known to the application.

Applicability of the registration methods depends on the map package type. There are a map packages of the old (classic) type in the wild and the first method is applicable only to these old-fashioned packages. Also, there are a map packages of the new type and the second method is exclusively for a packages of the new type. Sometimes it can be hard for user to determine the package type because from the technical perspective it's perfectly possible to further pack any map package in a single executable (setup.exe or like this). But if that's not the case and the package contents is visible, it's easy to recognize the new package type by the presence of "Info.xml" or "Info_v2.xml" file in the package. Map packages of the new type are becoming more common. These packages have the extension .gmap or .gmapi. Sometimes they are presented as maps for Mac OS X (RoadTrip/BaseCamp), but they can be used on a Windows computer too. In the Mac OS X GUI such packages looks like a files but they're actually a zip archives.

With the first method, user starts an installer, that, in turn, performs an automated procedure during which it writes all the necessary information about the mapset to a records at pre-defined locations in the Windows registry. So the Garmin application becomes aware of the map. The example below shows the particularies.

Mapset information the installer possesses before starting with the map registration procedure:

Map Family name: "OpenStreetMap Iceland"
Map Family ID: 0x027F
Map Product ID: 1
Mapset target location root directory: "D:\Garmin_Maps\OSM_Iceland"
Tile files target directory: "D:\Garmin_Maps\OSM_Iceland\Tiles"
Base map file: 13314530.img
Tile DB file: 13314530.tdb
MDR file: 13314531.img
MDX file: Iceland.mdx
TRF file: Iceland.trf
TYP file: Iceland.typ
Notice file: readme.txt

When the registration procedure has finished, all the mentioned information items are written to the Windows registry, and all mapset files are written to their target directories as specified in the registry. This is what the respective registry records looks like afterwards (assuming Windows 64-bit edition):

[HKLM\SOFTWARE\Wow6432Node\Garmin\Mapsource\Families\OpenStreetMap Iceland]:
"ID"=7F02
"IDX"="D:\\Garmin_Maps\\OSM_Iceland\\Iceland.mdx"
"MDR"="D:\\Garmin_Maps\\OSM_Iceland\\13314531.img"
"TRF"=""D:\\Garmin_Maps\\OSM_Iceland\\Iceland.trf"
"TYP"="D:\\Garmin_Maps\\OSM_Iceland\\Iceland.typ"

[HKLM\SOFTWARE\Wow6432Node\Garmin\Mapsource\Families\OpenStreetMap Iceland\1]:
"Bmap"="D:\\Garmin_Maps\\OSM_Iceland\\13314530.img"
"Loc"="D:\\Garmin_Maps\\OSM_Iceland\\Tiles"
"Tdb"="D:\\Garmin_Maps\\OSM_Iceland\\13314530.tdb"
"Notice"="D:\\Garmin_Maps\\OSM_Iceland\\readme.txt"

By the way an installer tool can be as simple as a Windows command file (or a .reg file or manual action sequence as a last resort). The example below shows the batch file that registers all mapset files, which are located in the current directory:
-------------------------------------------------------
@echo off

set FAMILY_NAME="Sample Vendor Map"
set FID=F518
set PID=1

echo Starting %FAMILY_NAME% import
echo Adding registry keys (%PROCESSOR_ARCHITECTURE%).

if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
set KEY=HKLM\SOFTWARE\Wow6432Node\Garmin\MapSource
) else (
set KEY=HKLM\SOFTWARE\Garmin\MapSource
)
echo Root key = %KEY%

@echo on

reg DELETE %KEY%\Families\%FAMILY_NAME% /va /f

reg ADD %KEY%\Families\%FAMILY_NAME% /v ID /t REG_BINARY /d %FID% /f
reg ADD %KEY%\Families\%FAMILY_NAME% /v IDX /t REG_SZ /d "%~dp0sample_map.mdx" /f
reg ADD %KEY%\Families\%FAMILY_NAME% /v MDR /t REG_SZ /d "%~dp0sample_map_mdr.img" /f
reg ADD %KEY%\Families\%FAMILY_NAME% /v TRF /t REG_SZ /d "%~dp0sample_map.trf" /f
reg ADD %KEY%\Families\%FAMILY_NAME% /v TYP /t REG_SZ /d "%~dp0sample_map.typ" /f

reg ADD %KEY%\Families\%FAMILY_NAME%\%PID% /v Loc /t REG_SZ /d "%~dp0" /f
reg ADD %KEY%\Families\%FAMILY_NAME%\%PID% /v Bmap /t REG_SZ /d "%~dp0sample_map.img" /f
reg ADD %KEY%\Families\%FAMILY_NAME%\%PID% /v Tdb /t REG_SZ /d "%~dp0sample_map.tdb" /f
reg ADD %KEY%\Families\%FAMILY_NAME%\%PID% /v Notice /t REG_SZ /d "%~dp0sample_map.txt" /f
---------------------------------------------------

The second method relies on a dedicated XML file, which is provided in the map distribution package as discussed early. That file contain all the necessary information about the mapset. The Garmin desktop application (MapSource/BaseCamp) is aware of the purpose of that file and is able to parse it. Windows registry is no more used. Registering such maps with the Garmin application for Windows is easy:

1. Download and unzip the gmap(i) package archive of the wished map.

2. Close the Garmin application (if still running).

3. Put the unzipped <map name>.gmap folder to the Garmin Maps folder (e.g. "C:\ProgramData\Garmin\Maps". Exact location may vary depending on the Windows version and Garmin application).

4. Start the application and open Map Product Manager window. Check that a text string for the registered map is listed there.