May 252009
 
Contour lines

Contour lines

I wanted to make my own contour maps for my Garmin eTrex Vista HCx GPS using data from the Shuttle Radar Topography Mission. I tried using dem2topo, but because I got an out of memory error, I searched an utility to split GeoTIFF files. I found one in the Geospatial Data Abstraction Library (GDAL). In this way I discovered that there is a GDAL utility to make contour maps too. This utility produces shapefiles, but fortunately GPSMapEdit can import shapefiles and export the Polish Map files that cGPSmapper requires.

To make things easier I wrote software to automate the complete process. The software takes a GeoTIFF file as input, splits it into smaller tiles, generates contours, simplifies contours, converts shapefiles into Polish Map files and calls cGPSmapper for the conversion to Garmin format. This makes it very easy to make contour maps, even for inexperienced users. I am sharing this software here under the GNU General Public License.

To make your own contour map, follow these steps:

  1. Download and unzip Tif2mp
  2. Download and install Microsoft .NET Framework 3.5
  3. Download and install FWTools
  4. Download and unzip cGPSmapper
  5. Download and unzip MapSetToolKit
  6. Download and unzip pre-processed data of your choice from CGIAR-CSI or ASTER
  7. Start Tiff2mp (double click the .exe file)
  8. Select the unzipped .tif file
  9. Select the cGPSmapper executable
  10. Select the ‘Convert!’ button and have patience
  11. Create a directory to install the map into (usually C:\Garmin\…)
  12. Start MapSetToolKit (double click the .exe file)
  13. Select ‘Select IMG’ and select the folder where you unzipped the GeoTIFF file
  14. Highlight the .img file and select the ‘Add –>’ button
  15. Select the ‘…’ button after ‘Mapset directory’ and select the install directory
  16. Type a ‘Mapset name’
  17. Type a ‘Family ID’
  18. Select ‘cgpsmapper/cpreview folder’ and select the correct directory
  19. Check ‘Install in MapSource’
  20. Select  the ‘START’ button
  21. Start MapSource, select the new map and transfer it like usual

The generated maps will have five levels, one for minor, intermediate and major contour lines, one with a single POI in the middle of the map with the id of the map and one empty level.

The default settings should be okay for most uses, but it is possible to alter the contour intervals and associated zoom levels. It is also possible to adjust in how many parts the GeoTIFF will be split. The default value is 5×5, which results in 25 tiles of 1° (about 100 km2). Furthermore it is possible to adjust the simplify accuracy of the Ramer-Douglas-Peucker algorithm. The default value will be set to half of the minor contour interval. You can easily check what the result of the simplification process is, by making a map again with the simplification accuracy set to zero and ‘Depth contours’ checked (this results in another colour contour lines). Open one of the maps in GPSMapEdit and add the other one to see the differences.

Tif2mp was written using Microsoft Visual Studio 2008 in the C# language. You can download the entire project here.

Comments, corrections and remarks are very welcome, also if you just succeeded making your own map.

Change log

Version 1.6

  • Added multiple select for batch conversion
  • Changed way identifiers are generated

Version 1.5

  • Added option to override/specify tile size
  • Modified zoom levels

Version 1.4

  • Added support for ASTER data

Version 1.3

  • Changed ‘GDAL Tools’ into ‘FWTools’
  • Increased all zoom levels by one

Version 1.2

  • Workaround WPF scroll bug
  • Added ‘Current tile’

Version 1.1

Version 1.0

  • Initial version
 Posted by at 9:17  Tagged with:

  9 Responses to “How to create custom Garmin contour maps”

  1. Great program, really useful. There does appear to be a problem with some Aster tiles

    I have had problems with generating the maps using Tif2mp for some Aster tiles. Of the tiles I have been using, Tif2mp only seems to happen in the ones which have no data values (-9999). Examples of this are N60E007 and N60E006. I tried replacing the -9999 values with 0 and Tif2mp worked.

  2. thx for sharing the information on garmin contour.. will try to use it.

  3. Hi, great work !
    But while I can get the FWtools to produce a set of shapefiles, I cannot seem to get cGPSMapper to work, ir fails complaining of SENDG.DDL missing, corrupt or wrong version.
    The shapefiles work though, since I can import them into MAPWEN and view them ok.

    Is there any chance you can extend this really useful program to also use the hi-res ASTER data available from http://www.gdem.aster.ersdac.or.jp/search.jsp ?
    I tried loading one of these tiles, but they are 3501 * 3501 pixels, not 6001 * 6001.

  4. When I tried this, when I go to the Garmin Setup -> Map Setup menu, and then to the “Info” screen to select the new map, it doesn’t list any maps, and only seems to hang. My map is only 364 kb, so I doubt I’m taxing the unit. Any ideas? Thanks.

  5. Hi, I’m following your instructions regarding tiff2m and am getting the following error below Current tile:

    Cannot find the file specified.
    I’ve downloaded a tif map:srtm_36_02.tif
    I wonder which file?

    am using vista

    Regards

    Nick Willink

    • I think you should check if FWTools is installed correctly. Normally the tools are installed in the folder C:\Program Files\FWTools<version>. This folder should be selected as GDAL Folder (in the next version I will rename this for clarity). Let me know if this solves your problem.