Multi-scale topographic position visualizations

I thought that people would enjoy this beautiful map that I have been working on this holiday season. It is a visualization derived from an SRTM digital elevation model based on a multi-scale topographic position analysis. This is one that you really have to click to enlarge to fully appreciate. I have spent hours lost in the detailed galactic colouring of this map!

This beautiful map of eastern Canada and the US was made with Whitebox GAT’s newest multi-scale topographic position tools. (click on image to enlarge)

This beautiful map of eastern Canada and the US was made with Whitebox GAT’s newest multi-scale topographic position tools. (click on image to enlarge)

I’m working on a paper right now in which I describe a new form of local topographic position analysis and the map above is one of the resulting visualizations. It shows prominent features at the small (blue channel), medium (green channel), and large (red channel) scales. A prominent feature is one that is either significantly above or below the surrounding landscape at the scale of interest. There’s actually a fair amount of analysis (and coding!) involved but if you’re really interested and can’t wait for me to finish the paper, send me an email. Here is a similar map but covering parts of British Columbia, Canada:

Mulit-scale topographic position for British Columbia, Canada (click to enlarge)

Mulit-scale topographic position for British Columbia, Canada (click to enlarge)

And this is the multi-scale topographic position map derived from SRTM data for the Northern Territory of Australia:

Topographic position map of the Northern Territory, Australia (click to enlarge)

Topographic position map of the Northern Territory, Australia (click to enlarge)

Personally, I think that these visualizations are remarkable for their ability to characterize the structure of the surface geology of a region but I’m sure that there are many other interesting applications as well. Interpreting the images takes a bit of experience but the following interpretation key can help:

Interpretation Key

Interpretation Key

Leave your comments below and, as always, best wishes and happy geoprocessing.

****UPDATE (May 27, 2015)****

This work was eventually written up as a manuscript and has recently been accepted for publication by the journal Geomorphology. The citation is:

Lindsay, J.B., Cockburn, J.M.H., and Russell, H.A.J. In press. ‘An integral image approach to performing multi-scale topographic position analysis’ Geomorphology, 245, DOI: 10.1016/j.geomorph.2015.05.025.

This article can be downloaded for free until July 18, 2015 from the following link:,3sl3TsZi

And the submitted draft is available here.


Hexbinning in Whitebox GAT

The practice of binning point data to form a type of 2D histogram, density plot, or what is sometimes called a heatmap, is quite useful as an alternative for the cartographic display of of very dense points sets. This is particularly the case when the points experience significant overlap at the displayed scale. This is the type of operation that is used (in feature space) in Whitebox‘s Feature Space Plot tool. Normally when we perform binning, however, it is using a regular square or perhaps rectangular grid. The other day I read an interesting blog on hexbinning (see also the excellent post by Zachary Forest Johnson also on the topic of hexbinning), or the use of a hexagonal-shaped grid for the creation of density plots.

A Hex-binned heatmap

A Hex-binned heatmap (click to enlarge)

These blogs got me excited, in part because I have used hex-grids for various spatial operations in the past and am aware of several advantages to this tessellation structure. The linked hexbinning blogs point out that hexagonal grids are useful because the hexagon is the most circular-shaped polygon that tessellates. A consequence of this circularity is that hex grids tend to represent curves more naturally than square grids, which includes better representation of polygon boundaries during rasterization. But there are several other advantages that make hexbinning a worthwhile practice. For example, one consequence of the nearly circular shape of hexagons is that hex-grids are very closely packed compared with square grids. That is, the average spacing between hexagon centre points in a hex-grid is smaller than the equivalent average spacing in a square grid. One way of thinking about this characteristic is that it means that hexagonal grids require about 13% fewer data points then the square grid to represent a distribution at a comparable level of detail. Also, unlike a square grid, each cell in a hex-grid shares an equal-length boundary with its six neighbouring grid cells. With square grids, four of the eight neighbouring cells are connected through a point only. This causes all sorts of problems for spatial analysis, not the least of which is the characteristic orientation sensitivity of square grids; and don’t get me started on the effects of this characteristics for surface flow-path modelling on raster digital elevation models. Hex-grid cells are also equally distant to each of their six neighbours. I’ve even heard it argued before that given the shape of those cone and rod cells in our eyes, hex-grids are more naturally suited to the human visual system, although I’m not sure how true this is.

Hexagonal grids are certainly worthwhile data structures and hex-binning is a great way to make a heatmap. So, that said, I decided to write a tool to perform hex-binning in Whitebox GAT. The tool will be publicly available in the 3.2.1 release of the software, which will hopefully be out soon but here is a preview:

Whitebox's Hexbinning tool

Whitebox’s Hexbinning tool (click to enlarge)

The tool will take either an input shapefile of POINT or MULTIPOINT ShapeType, or a LiDAR LAS file and it will be housed in both the Vector Tools and LiDAR Tools toolboxes. Here is an example of a hex-binned density map (seen on right) derived using the tool applied to a distribution of 7.7 million points (seen on left) contained in a LAS file and derived using a terrestrial LiDAR system:

Hexbinned LiDAR points

Hexbinned LiDAR points (Click to enlarge)

Notice that the points in the image on the left are so incredibly dense in places that you cannot effectively see individual features; they overlap completely to form blanket areas of points. It wouldn’t matter how small I rendered the points, at the scale of the map, they would always coalesce into areas. The hex-binned heatmap is a far more effective way of visualizing the distribution of LiDAR points in this case.

The hexbinning tool is also very efficient. It took about two seconds to perform the binning on the 7.7 million LiDAR points above using my laptop. In the CUNY blog linked above, the author (I think it was Lee Hachadoorian) describes several problems that they ran into when they performed the hexbinning operation on their 285,000 points using QGIS. I suspect that their problems were at least partly the result of the fact that they performed the binning using point-in-polygon operations to identify the hexagon in which each point plotted. Point-in-polygon operations are computationally expensive and I think there is a better way here. A hex-grid is essentially the Voronoi diagram for the set of hexagon centre points, meaning that every location within a hexagon grid cell is nearest the hexagon’s centre than another other neighbouring cell centre point. As such, a more efficient way of performing hexbinning would be to enter each hexagon’s centre point into a KD-tree structure and perform a highly efficient nearest-neighbour operation on each of the data points to identify their enclosing hexagon. This is a fast operation in Whitebox and so the hexbinning tool works well even with massive point sets, as you commonly encounter when working with LiDAR data and other types of spatial data.

So I hope you have fun with this new tool and make some beautiful maps. Leave your comments below and, as always, best wishes and happy geoprocessing.

John Lindsay

Creating beautiful relief models

Recently I stumbled across a couple of very interesting questions over on the GIS Stack Exchange. One of them was about the use of appropriate colour palettes for displaying DEMs, and the other was about colour palettes for hillshade images. This last one in particular got me thinking a lot about effective cartographic display of terrain and introduced me to the work of the famous Swiss cartographer Eduard Imhof. Why is it that every hillshade image that I have ever created is displayed in a greyscale palette?

Greyscale hillshade of the Banff area.

Greyscale hillshade of the Banff area. (Click to enlarge)

I’ve always thought that hillshading is a very effective way of visualizing topographic information, but greyscale hillshade images by themselves are so boring! Of course the answer is that I don’t normally just display a hillshade image. Instead, the hillshade image is displayed transparently over top a DEM, with colour used to relay elevation information and tone used for illumination. This type of composite relief model is very effective for visualizing terrain. But what about using other colours for illumination other than simply greyscale hillshading, like Imhof did so long ago? To do this effectively in Whitebox, you may want to create a custom palette using the Palette Manager (under the Tools menu), one of the most under-used tools in Whitebox:

The Palette Manager tool in Whitebox GAT

The Palette Manager tool in Whitebox GAT

So here is a hillshade image displayed using the custom palette above [simply blending RGB(0, 50, 100) to RGB(255, 240, 170)]:

Imhof inspired hillshade

Imhof inspired hillshade. (Click to enlarge)

I think that’s beautiful. It’s like bathing the landscape in warm, bright sunlight. Of course, we can actually take this a step further. My father is an artist and retired art teacher. I remember when I was growing up, he taught me that the atmosphere is actually coloured when you have enough air thickness; it’s a little blue. That’s why in this painting of his, one of my favourites, you can see that the hills in the distance become slightly bluer:

Notice the blue ting for distant mountains

Notice the blue tinge for distant mountains (Powassan landscape by James M. Lindsay)

I now know that this phenomenon is called Rayleigh scattering (the reason that the sky is blue), and koodos to my Dad for inherently understanding this phenomenon. So since the height of the air column and density of the atmosphere are greater in the valley bottoms, there should be a ‘blue tinge’ in the valleys. We can create this ‘blue tinge’ by transparently overlaying the DEM, displayed in a light-blue-to-white palette (again created using the Palette Manager), and get this:

Final hillshade image

Final hillshade image. (Click to enlarge)

You can play around with the palettes and the levels of transparency (and display minimum and maximum values) until you get things just the way that you want. It’s almost artistic! I think we can all agree however that this final hillshade is a much more visually pleasing and a more effective display of terrain compared to that initial greyscale image. It looks less like a photo taken of the harsh lunar landscape and more like an earthscape. So have some fun with it and don’t always except the default values of things. And terrain displayed in this way lends itself well to overlaying other information:

Columbia Icefield map. (Click to enlarge)

Columbia Icefield map. (Click to enlarge)

Leave your comments below and, as always, best wishes and happy geoprocessing.


Whitebox GAT for making pretty maps?

I spend most of my time in Whitebox GAT performing geospatial analyses of one kind or another. I’ll certainly admit that in terms of developing Whitebox the emphasis has always been on advanced geospatial analysis and that cartographic output has taken a lower-priority role. Nonetheless, Whitebox can be used to make some rather stunning maps. Here’s an example of a beautiful map that I recently created for a report that I thought I’d share as an example of what can be accomplished:

Example Whitebox map

An example of a beautiful map created using Whitebox GAT. Click on the image for a full sized version.

The map was created entirely in Whitebox GAT and exported as an image for inclusion in the report. (Before my students start wagging their fingers at me…I know that it’s missing a title. Be assured that the title was provided by the figure caption within the report.) If you would like to see some cartographic capability that is not already incorporated in Whitebox GAT, send me a feature request (Help menu -> New Feature Request) and I’ll put it on my Extended To-Do list. So, as always, best wishes and happy map-making 😉

John Lindsay