Friday, March 6, 2015

Killer Visuals Through Enhanced Relief

One of CalTopo's core features has always been the ability to blend multiple map layers together.  Until now, that's been done by creating a layer stack and varying the opacity of each layer to suit.  This works, but shaded relief has always been a weak point.  In order to keep the relief layer from washing out the rest of the map, I had to crank up the exaggeration.  This meant you could use less relief and get less washout, but it reduced the layer's ability to capture small details.

Even so, it's never played well with aerial imagery.  Consider the image of Mt Shasta below; you can make out terrain features from the relief layer, but the imagery itself is starting to get washed out.

Professional mapmakers solve this problem by using more advanced techniques than opacity based layer stacking.  One of those is to do a multiply blend, where each pixel on the map is multiplied by the intensity of the hillshade, on a 0-1 scale.  This darkens the image a bit, but does a much better job of preserving it.  The photo below is the same image of Shasta with multiply blend relief shading . . .

There's no way to a multiply blend in Google Maps, so I have to fetch all the tiles on my server, combine them into a single image, and then pass them back to the browser.  This means that when using the enhanced relief layer, the map won't react to react to opacity adjustments in real time - it has to fetch a new batch of images instead of just changing a CSS parameter.  It also means that images not available to my server - like Google's - will default to the standard relief shading.

While the effect is more subtle with maps than with images, but I still think it's an improvement.  Below are maps of Mt Shasta with both standard and enhanced shading:

This is still experimental, so I may make some changes going forward, including switching to an approach that lightens some parts of the image and darkens others.  While enhanced relief works with printing, it reverts to standard shading for KMZ exports.  Still, I'd rather get it out there and get feedback than tinker away privately until it's perfect.


  1. Hi Matt-

    I absolutely love Caltopo. I'm constantly surprised by all the features that are included.

    These shaded relief layers look really great! However, I only the "Normal" layer shows up for me. Both the "enhanced shaded relief" and "terrain shading" layers are blank. I thought maybe coverage was limited to specific geographical areas but I just checked Mt. Shasta (the example shown above) but it's still blank.

    Do I need a specific plug-in or something to get this to work? FYI, I tried both Safari and Chrome browsers.