I recently went for a mountain bike ride in a mountainous area of the Western Cape (South Africa). This location is littered with mountain bike trails but some of them are very steep and ideally suited to dedicated downhill cycling. It isn’t always obvious where the trail you’re on may go and a vertical climb isn’t always desirable. Wouldn’t it be great to have a GPS with both detailed cycling routes and topographic data/contours ?
Probably, yes. Luckily I have an old-ish Garmin eTrex HCX “Color” handheld GPS. In my mind it’s still a new-ish device, but in reality it was released to the market 11 years ago in 2007. For reference, that’s one year after the Intel Core 2 was released – so tech has changed a bit… but apparently not much for Garmin GPSs.
This eTrex has a microSD card slot, which probably supports cards up to 2GB in size. That’s more than enough for elevation data and some South African bicycle maps.
To generate said maps, under Ubuntu Linux (18.04), I did the following, improvised from the OpenStreetMap wiki :
Download a suitable .osm.pbf from here : http://download.geofabrik.de/africa.html
Download Splitter : http://www.mkgmap.org.uk/doc/splitter.html
Download a style file : wget https://svn.openstreetmap.org/applications/utils/export/garmincyclemap/network/cyclemap.TYP
Install subversion if you don’t already have it :
sudo apt install subversion
Get mkgmap’s repository :
svn co https://svn.openstreetmap.org/applications/utils/export/garmincyclemap/network/cyclemap
Get the mkgmap JAR file :
http://www.mkgmap.org.uk/download/mkgmap.html
Split your PBF files : (I gave it 8GBs of RAM, but you may not have that)
java -Xmx8096m -jar splitter.jar --max-nodes=900000 south-africa-latest.osm.pbf
Convert the split files into a gmapsupp.img file : (RAM, if available, set to 8GBs and threads set to 16 threads)
java -Xmx16000m -jar mkgmap-r4240/mkgmap.jar --style-file=cyclemap --route --description=aquarat --mapname=aquarat --gmapsupp --max-jobs=16 --keep-going -c template.args
Make a directory:
mkdir archive
Move gmapsupp.img into archive :
mv gmapsupp.img archive/gmapsupp-cycling.img
mv south-africa-latest.osm.pbf archive/
Delete the temporary stuff :
rm *.img *.pbf
Now for the contours! Download a suitable contour file here : http://develop.freizeitkarte-osm.de/ele_20_100_500/
wget http://develop.freizeitkarte-osm.de/ele_20_100_500/Hoehendaten_Freizeitkarte_ZAF.osm.pbf
Split it :
java -Xmx8096m -jar splitter-r591/splitter.jar --max-nodes=900000 archive/Hoehendaten_Freizeitkarte_ZAF.osm.pbf
Render it to gmapsupp.img :
java -Xmx16000m -jar mkgmap-r4240/mkgmap.jar --style-file=cyclemap --route --description=topoaquarat --mapname=aquatopo --gmapsupp --max-jobs=16 --keep-going -c template.args
Move it to archive :
mv gmapsupp.img archive/gmapsupptopo.img
Combine all the things :
java -Xmx16000m -jar mkgmap-r4240/mkgmap.jar --style-file=cyclemap --route --description=topoaquarat --mapname=aquatopo --gmapsupp --max-jobs=16 --keep-going archive/gmapsupptopo.img archive/gmapsupp-cycling.img
aaaand copy the resulting file to your device’s SD card :
mkdir -p /media/cooluser/somedevice/garmin
cp gmapsupp.img /media/cooluser/somedevice/garmin
Eject and you’re done.
It looks like this site may do some of these things too : https://extract.bbbike.org/