cGPSmapper on linux

cGPSmapper is the map compiler for Garmin compatible maps. There are various versions, for Linux and M$-Windows. The M$-Windows versions tend to be newer and there are commercial versions with greater funtionality, but at a price.

The Linux version works pretty well for basic mapmaking.

There is a companion program sendmap for joining multiple maps togetehr so they can be sent to the GPS.

cgpsmapper: Viewing your maps in Mapsource

OK, this is not strictly a linux problem, but till I find a Linux equivalant to Mapsource I'm stuck with running mapsource under vmware and I do want the convenience of getting my home made maps into Mapsource for when I want to have both Garmin and homemade maps at the same time.

To be able to access your own maps in Mapsource you need to build a preview which consists of a .img file and a .tdb file and then add some links into the Windows Registry.

If you get the registry correct but the .img file is missing, when you try to switch to your mapset, Mapsource will display a warning then exit. If the .tdb file is missing, Mapsource will complain about a registry error and fail to start.

Creating the preview files

Pretty simple. You have to compile your maps then create a file like a .mp file that contains the definitions for the preview. For this example, we will work with 2 maps I want to compile. I do this from the .mp files with

cgpsmapper -l ac 90001001.mp
cgpsmapper -l ac 90001002.mp
Then the control file to create the template is
[Map]
FileName=Homemaps
FID=800
MapVersion=100
ProductCode=1
Levels=2
Level0=18
Level1=16

Zoom0=5
Zoom1=6

MapsourceName=Homemade Maps
MapSetName=Homemade Maps
CDSetName=Homemade Maps
[End-Map]

[Files]
img=90001001.img
img=90001002.img
[END-Files]
I name this file pv.cgps and build my preview map with
cgpsmapper -l pv pv.cgps

One thing that does require care is to make sure your map files and the preview file have compatible level and Zoom settings. The cGPSmapper manual states that

The lowest zoom level in the preview should be the highest in the detailed map.

The least zoomed level in a detail map will contain no data, its basically a marker for where the preview map will take over.
Levels=5
Level0=24
Level1=22
Level2=20
Level3=19
Level4=18
Zoom0=0
Zoom1=1
Zoom2=2
Zoom3=3
Zoom4=4

So the Zoom slots need to be contiguous, eg 0,1,2,3,4 in the map and 5,6 in the preview and the Level detail share one common detail setting eg 24,22,20,19,18 in the map and 18,16 in the preview.
Seems to work anyway.

Adding to the registry

Warning: If you are not confident of your ability to edit the registry, don't do it. Go find someone that knows what they are doing!

To make Mapsource look for your maps, you need the registry entries. The entries you need are pretty simple. Garmin Mapsource creates a registry section

HKEY_LOCAL_MACHINE\SOFTWARE\Garmin\MapSource
Within that there is a Products and/or Families section and within that an entry for each set of maps. If you have any Garmin maps installed, you will find those already there.

For your maps you just need to add a new sub-section into one of these two keys. I can't work out what the difference is at the moment. cgpsmaper will generate a registry add script for you that adds to the Products section if you don't add an FID field in your preview configuration and to the Families section if you do have an FID.

From my understanding of the docs, I think that to make custom types (ie to change the way things look on screen) work in Mapsource, needs an FID definition.

Note: you should set up one or the other. Mapsource will complain of registry errors (and suggest you reinstall Mapsource - duh) if you have the same names in both sections.

Here is an example of a regedit batch file to set up a productsmap section... You must customise the paths and names to match your install

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Garmin\MapSource\Products\Homemaps]
"LOC"="Y:\\mapsource\\MYMAPS\\"
"BMAP"="Y:\\mapsource\\MYMAPS\\Homemaps.img"
"TDB"="Y:\\mapsource\\MYMAPS\\Homemaps.tdb"

Here is an example of a regedit batch file to set up a familiesmap section... You must customise the paths and names to match your install!!

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Garmin\MapSource\Families\Homemaps]
"ID"=hex:20,03

[HKEY_LOCAL_MACHINE\SOFTWARE\Garmin\MapSource\Families\Homemaps\1]
"LOC"="Y:\\mapsource\\MYMAPS\\"              
"BMAP"="Y:\\mapsource\\MYMAPS\\Homemaps.img"        
"TDB"="Y:\\mapsource\\MYMAPS\\Homemaps.tdb"       

The ID value is the family ID. Its the FID value from the preview configuration file. Note it is in hex and with the low byte first. "20,03" is 0x0320 which is decimal 800. As I understand it, the only issue with selecting the FID is not generating a clash with anything else you have loaded. It looks like garmin seem to be using low values (less than 256 decimal for the products I've seen). I've seen docs that suggest the value 800 as a private value.

Note that in 64 but Win 7 systems you need the base path

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Garmin\MapSource\Families\Homemaps]

Also it looks like some versions of cGPSmapper get the TDB file header wrong. Byte 5 and 6 (starting at 0) should be the same as your FID, in [low,high] order. ie the same order as the ID value. If this is wrong Mapsouce just silently (duh!) ignores your map. You will need to find a binary editor or some tool that lets you fix the .TDB file.

This issue with the FID in the TDB file is new to me(2013). It may be a result of upgrading Mapsource Thanks to [_id] ProductCode=1 FID=800 [End]

There is nothing special in the [IMG ID] section of my map .img files.

I drove the M$-Windows sendmap with

y:\sendmap20\sendmap20.exe -l y:\MYMAPS\90001001.img y:\MYMAPS\90001003.img CUSTOM.TYP

This generated me a GMAPSUPP.IMG that I copied to a flash card

cp GMAPSUPP.IMG /mnt/garmin/gmapsupp.img

More to come...

[Last edit: 29Jan2013]