Planning Trips with QMapShack

I like having a plan for my hiking and biking trips (Northern California), to have an idea about their length and aggregated climb, and also to have a track in my GPS to stop wondering if I am taking the right route.

Unfortunately, I could not do that with Garmin software, Basecamp. Proprietary $$$ Topo 24k map doesn’t have bike trails, free Opencycle map doesn’t have elevations.

I found a perfect solution in QMapShack, a free mapping application for Linux, Windows and Mac, which can also use free map and elevation data. This is an attempt on an end-to-end guide from setting it up to using it to plan trips.

overview

Installation

Here is the QMapShack official installation page, just in case.

If you’re on Windows or Mac, you may get pre-built installers from QMapShack downloads page.

I am on Linux Mint 17.2 (Mint is based on Ubuntu, which is, in turn, based on Debian).

UPDATE: Ubuntu 16.04 has Qmapshack in its package repository! Just run “sudo apt install qmapshack” or use you favorite package installer tool.

QMapShack is not in the official Ubuntu package system yet, and there is no ppa to install it directly from the ‘net and maintain updates. That said, there is an easy way to install it, by using a Debian package from QMapShack Debian backports page. You will need libroutino and the following dependency packages, though:

apt-get install libqt5script5 libqt5scripttools5 gdal-bin libgdal-dev libgdal1h python-gdal

To build routino library, you will need to get/build graphics magick. Try installing all dependencies via apt-get, but I had to build graphics magick from source.

sudo apt-get install libz-dev libbz2-dev libgraphics-magick-perl

svn co http://routino.org/svn/trunk routino

cd routino

make

sudo checkinstall -D --pkgname=routino --pkgversion=3.0 --arch amd64 --backup=no

(thanks Emanuel!)

At this point, qmapshack should start.

Setting up a Trail Map

Download a free Open Cycle map (it has tons of hiking trails too) for your area from:

http://www.openfietsmap.nl/downloads/worldwide

Select your location and select gmapsupp.img format (this is the format for uploading directly to Garmin device. You can put this file into a Garmin device and have it giving you on-the-fly directions on streets and trails!)

You can also use with QMapShack any *.img map file that works in Garmin (I tried California Topo 24K and it worked fine).

Create a directory for keeping maps, elevations and route data for QMapShack. Mine is at ~/Maps.

Put the gmapsupp.img file you downloaded into that directory and select the directory in File -> Setup Map Paths in QMapShack. The map should appear in map files list – right-click on it and select “Activate”:

select-map

map

There is no elevations in this picture, let’s add them!

Adding Elevation Model

I am in the US, so the information below is for getting and installing US elevation data.

The US National Elevation Dataset has elevation data with ⅓ arc second resolution. This mean 10m/30ft per grid point – pretty good! Download files from here: http://viewer.nationalmap.gov/basic/?basemap=b1&category=ned,nedsrc&title=3DEP%20View

Select ⅓ arc second DEM (they actually have 1/9 arc second resolution for some areas which is pretty cool, but takes a lot of space, a long time to download, and regular GPS track resolution is not that great anyway).

Unpack the files (e.g. into some subfolder in “Maps” directory, like “mosaic”). If they are in ArcGRID format, list all *.adf files (find . -name w*.adf -print) then run:

gdalbuildvrt mosaic.vrt file1.adf file2.adf fileN.adf

or simply:

gdalbuildvrt mosaic.vrt `find . -name w*.adf -print`

If they are in some other format, you will need to do some research on what gdalbuildvrt accepts.

Now select this directory in QMapShack: File -> Setup DEM Paths.

Open vrt file as a folder – click on triangle to see elevations display options and check “hillshading”, then drag the slider all the way to the left. Move top slider to adjust elevation layer transparency:

mosaic

shaded-map

Elevation Grade Shading

One other cool option is to see the elevation grades in different colors.

In elevation options, check “Slope” and move the associated slider.

grade-shading

Obtaining and building routing DB

Get .pfb files for your area from GeoFabrik (Make sure to click through to your local area first, to avoid asking 6.9GB for complete North America):

http://download.geofabrik.de/

Create routino database: Menu Tool -> Create Routino Database, add .pfb file

Making tracks

You can do routes as well, but I find tracks to be more useful (less battery drain and less confusion introduced by imperfect GPS reception).

make trackRight-click on start location and select “Add Track”.

There are 3 modes of laying a track:

  • O – manual
  • A – automatic, using Routino or another router (select it in the combo box on the right)
  • V – follow vector features on displayed maps

To delete points, click on the trash can button, to continue adding, click on “+” button.

When saving tracks, save them as .gpx, for easier exchange with Garmin. Note that the consumer-grade Garmin devices limit the number of points in a track (500 in my case), so you might need to draw several tracks for your route.

To save track, right-click on track folder and select “Save”.

Viewing Track Profile

Right-click on a saved track, and select “Edit”.

edit-trackYou will get on track review screen. You may move slider across the profile and see some useful stats such as slope grade, elevation, distance and speed.

elevation-profile

GPS Device Communication

My Garmin Vista HCX is an older device, it does not have GarminDevice.xml file and cannot communicate with QMapShack directly. I am uploading and downloading tracks via gpsbabel. There are versions of gpsbabel for Linux, Windows and Mac.

To save track, right-click on track folder and select “Save”. Note that you can work around 500 point limit by splitting your large track into several small ones. If they are in the same project folder, they will be saved into same .gpx file and could be uploaded to device at once.

To upload:

save project as gpx file, then upload using gpsbabel:

gpsbabel -t -i gpx -f file.gpx -o garmin -F usb:

To download:

gpsbabel -t -i garmin-f usb: -o gpx -F file.gpx

then open in qmapshack!

(Note the order of command line options for format and file names, it matters.)

Permissions Fix

This fix is required on Linux to allow access to garmin usb devices – (note that for the mask options below you have to be in the plugdev group).

this syntax is applicable to 3.x kernels, for other kernel versions the syntax could be different:

file:

/etc/udev/rules.d/51-garmin.rules

contents:

SUBSYSTEM=="usb", ATTR{idVendor}=="091e", ATTR{idProduct}=="0003", MODE="0660", GROUP="plugdev"

reload rules with:

sudo udevadm control –reload-rules

Auto USB power-off fix for laptops

Using USB Garmin devices with Linux laptops might require turning off USB power management (assuming you use tlp package):

edit /etc/default/tlp

add anywhere this line:

USB_BLACKLIST="091e:0003"

Using Correct Device

On Linux, make sure  (lsmod|grep garmin) that garmin_gps module is not loaded (usually it is blacklisted, so it should be OK). The module makes a serial device from garmin USB, which is unnecessary and reportedly could get in the way of normal use.

Enable Track Display on GPS

On your GPS device, go to Setup screen, select a Track, choose its display color, and check “show on map” (images courtesy Garmin):

setupstracktrack

One thought on “Planning Trips with QMapShack

Leave a Reply

Your email address will not be published. Required fields are marked *