Contour Maps

Creating contour maps

Note that newer Edge models (530, 830, 1030, etc) already provide contour lines (you can turn them on and off in settings). So, this is more useful for older models.

You can create maps for your Edge to display contour lines.

While contour lines can be included in custom detail maps (maps with roads and places), they are usually provided as separate transparent maps that will overlay detailed maps. This lets you easily turn the contour lines on and off.

The Edge units let you use overlay maps. Garmin BaseCamp cannot (it can only use one img file at a time). Except, it can use the DEM map included on the newer Edges as an overlay.

This process is similar to creating normal maps. Just the source of data is different.

“srtm2osm” is the program that downloads the contour data and creates an OSM file. Use the “-feet” option to get contour lines in feet rather than meters (with “-feet”, you’ll see “m” after the elevation labels but they are in feet not meters).

Good information on how to do this can be found here:

http://www.cferrero.net/maps/mkgmap_tiddlywiki.html#contours

http://www.cferrero.net/maps/maps_index.html

1: Download the programs/tools needed to create the map:

Note that you’ll need to also install the runtime version of Java.

I installed srtm2osm and osmosis each in its own subfolder in one folder (I used “MapTools”). I compiled the map in the mkgmap folder. The command examples shown here are based on that.

(Osmosis is kind of old. You might consider using osmium instead.)

\MapTools\srtm2osm

\MapTools\osmosis

\MapTools\mkgmap\contours – where the map files are written to (make it easier to delete files you no longer need).

http://wiki.openstreetmap.org/wiki/Srtm2Osm -- srtm2osm

http://wiki.openstreetmap.org/wiki/Osmosis -- osmosis (used to sort the contour dat). Note the “Important: As of October 2015, osmosis.bat is broken” comment at the bottom of the page!


2: Download/extract the contour data:

There are a few ways of specifying the area of interest. The following uses the OSM website page. Include “-feet” (otherwise, the contour lines will be in meters).

“Bottom Left Top Right” are the decimal degrees of the bounding box you want the contours for (for example: “40.693359 -75.102539 41.484375 -73.652344”. You can get the values for this from the “areas.poly” file that mkgmap produces. Or, if you are using extracts.bbbike.org, from the name of the download file.

..\Srtm2Osm\Srtm2Osm.exe -large -feet -cat 500 200 -step 100 –bounds1 Bottom Left Top Right -corrxy 0.0005 0.0005 -o contours\srtm.osm


3: Sort the contour data:

..\osmosis\bin\osmosis.bat --read-xml file="contours\srtm.osm" --sort type="TypeThenId" --write-xml file="contours\srtm-sorted.osm"

(Osmosis is kind of old. You might consider using osmium to sort instead.)

4: Split the contour data:

Note that this uses the same map ID (20011) but starts the split files at number 80 (this lets the contours to be combined with other map data).

java -Xmx2048M -jar ..\splitter\splitter.jar --output-dir=contours --keep-complete=true --mixed=yes --mapid=20011080 --description=Contours --mixed=yes --max-nodes=5000000 contours\srtm-sorted.osm

5.1: Using mkgmap to create transparent (overlay) “gmapsupp.img”:

This creates a transparent contour map. Some devices and programs support using multiple img files. You enable or disable the contour map to turn the contours display on and off.

“contours_style” is a folder that contains “info”, “version”, “options”, “lines”, “polygons”, “points”, “relations”, “overlays” files which are empty style files except for “lines”.

The “lines” file contains the styles for the contours (copied from “Styles\inc\contours”):

contour=elevation & contour_ext=elevation_minor {name name '${ele|conv:m=>ft}'; } [0x20 resolution 22]

contour=elevation & contour_ext=elevation_medium { name '${ele|conv:m=>ft}'; } [0x21 resolution 22]

contour=elevation & contour_ext=elevation_major { name '${ele|conv:m=>ft}'; } [0x22 resolution 20]

The “contours_style\contours_typ.txt” file contains the TYP definitions for the contour lines type numbers (taken from 20011.TYP saved-as text from typviewer).

Create the map file using mkgmap

java -Xmx2048M -jar mkgmap.jar --output-dir=contours --style-file=contours_style --net --gmapsupp contours_style\contours_typ.txt --tdbfile --family-id=20011080 --product-id=1 --draw-priority=28 --transparent --series-name=contours --family-name=contours --area-name=contours -c contours\template.args

You can rename the map file to something other than "gmappsup.img" (just make sure the ".img" is at the end).

5.2: Using mkgmap to create a combination “gmapsupp.img” (map with contours):

This combines the contours with other map data (the contour map files are listed before the other map files. The styles used for contours is in “Styles\inc\contours”.

java -Xms1024m -Xmx1024m -jar mkgmap.jar --output-dir=map --gmapsupp 20011.TYP -c Styles\mymap.args -c contours\template.args -c map\template.args -c Styles\location.args