.. title: DEM data for QMapShack
.. slug: dem-data-for-qmapshack
.. date: 2019-07-25 23:33:29 UTC+02:00
.. updated: 2020-05-04
.. tags: gps, qmapshack
.. category: 
.. link: 
.. description: 
.. type: text

As noted in my previous post :doc:`geocaching-com-gpx` I still need to
rework my workflows from QLandkarteGT to the new `QMapShack
<https://github.com/Maproom/qmapshack>`_ tool as only the latter is
available for a Debian Buster system.

For my use cases, knowing the height of a map location is very
important and so providing QMapShack with digital elevation data (DEM
for short) is an important step.  I cannot remember exactly how I did
this for QLandkarteGT in the past, but I remember a lot of web
browsing to find and download the correct `Shuttle Radar Topology
Mission (SRTM)
<https://en.wikipedia.org/wiki/Shuttle_Radar_Topography_Mission>`_
followed by some magic script invocations to package it up for
QLandkarteGT.  Switching to QMapShack seems like a good time to
reevaluate how this can be done most easily.

.. image:: /images/srtm-tile-grabber.png
   :width: 500
   :align: center
   :alt: SRTM Tile Grabber

.. TEASER_END

It turns out that downloading the data has become a breeze.  The `SRTM
Tile Grabber <http://dwtkns.com/srtm/>`_ is a nice interface to pick
and download individual tiles.  In the screenshot I downloaded 5 tiles
covering the current region of interest:

.. code-block:: console

  dzu@krikkit:~$ ls -lh ~/Downloads/srtm_*
  -rw-r--r-- 1 dzu dzu 16M Jul 24 09:49 /home/dzu/Downloads/srtm_38_02.zip
  -rw-r--r-- 1 dzu dzu 37M Jul 24 09:50 /home/dzu/Downloads/srtm_38_03.zip
  -rw-r--r-- 1 dzu dzu 18M Jul 24 09:50 /home/dzu/Downloads/srtm_39_02.zip
  -rw-r--r-- 1 dzu dzu 36M Jul 24 09:50 /home/dzu/Downloads/srtm_39_03.zip
  -rw-r--r-- 1 dzu dzu 31M Jul 24 09:50 /home/dzu/Downloads/srtm_40_03.zip
  dzu@krikkit:~$
  
In QMapShack I already configured the program so that it expects DEM
data in the ~/gps/maps/DEM folder.  So let's unpack and wrap the data
as described in the `QMapShack wiki
<https://github.com/Maproom/qmapshack/wiki/DocBasicsMapDem>`_:

.. code-block:: console
  
  dzu@krikkit:~$ cd gps/maps/DEM/
  dzu@krikkit:~/gps/maps/DEM$ for f in ~/Downloads/srtm_* ; do unzip -o $f ; done
  Archive:  /home/dzu/Downloads/srtm_38_02.zip
    inflating: readme.txt              
    inflating: srtm_38_02.hdr          
    inflating: srtm_38_02.tfw          
    inflating: srtm_38_02.tif          
  Archive:  /home/dzu/Downloads/srtm_38_03.zip
    inflating: readme.txt              
    inflating: srtm_38_03.hdr          
    inflating: srtm_38_03.tfw          
    inflating: srtm_38_03.tif          
  Archive:  /home/dzu/Downloads/srtm_39_02.zip
    inflating: readme.txt              
    inflating: srtm_39_02.hdr          
    inflating: srtm_39_02.tfw          
    inflating: srtm_39_02.tif          
  Archive:  /home/dzu/Downloads/srtm_39_03.zip
    inflating: readme.txt              
    inflating: srtm_39_03.hdr          
    inflating: srtm_39_03.tfw          
    inflating: srtm_39_03.tif          
  Archive:  /home/dzu/Downloads/srtm_40_03.zip
    inflating: readme.txt              
    inflating: srtm_40_03.hdr          
    inflating: srtm_40_03.tfw          
    inflating: srtm_40_03.tif          
  dzu@krikkit:~/gps/maps/DEM$ gdalbuildvrt dach.vrt *.tif
  0...10...20...30...40...50...60...70...80...90...100 - done.
  dzu@krikkit:~/gps/maps/DEM$
  
The final step could also be done from the "VRT Builder" menu through
a GUI, but this would take a lot more to describe than simply to show
the easy command line interface.

Having the DEM data available, a right click in the "DEM Data" window
in QMapShack allows to refresh available data sources.  Having done
that, the data shows up and more options are available in the sub menu
that opens clicking on the small triangle:
  
.. image:: /images/qmapshack-flat.png
   :width: 500
   :alt: QMapShack flat map view
   :align: center

To visually overlay the height data, simply activate "Schummerung":
	 
.. image:: /images/qmapshack-shading.png
   :width: 500
   :alt: QMapShack with hill shading
   :align: center

As can be seen in the screenshots, with available DEM data, QMapShack
will not only display the height in the lower right hand corner, but
also the largest inclination at the cursor position.  This is very
useful for interactive exploration and for planning activities.

Update 2020-05-04
^^^^^^^^^^^^^^^^^

The same site now also has a downloader for the `30-meter resolution
data <https://dwtkns.com/srtm30m/>`_ as compared to the 90-meter
resolution offered by the URL above.

While here I also fixed the links for QMapShack as it migrated from
Bitbucket to GitHub.
