Wednesday, July 25, 2018

Wonderland Post 2: More Terrain

Terrain Tricks

Two tips that I picked up from Tom Patterson's page on texture shading are texture shading (obviously) and adding other elevation-derived products to the map using transparency (and, if you've got the time/inclination, multiply blend mode in Photoshop/GIMP—paging the ArcGIS Pro developers...).

Tonight we'll explore a couple different products added to our hillshade. First, for reference, is the hillshade placed under the DEM, with some transparency applied to both:


Slope
After some playing around, I've found that slope makes a great addition to hillshades (see my Zions Fireworks post). To generate this, I run gdaldem slope -p dem.tif out.tif, which generates a raster showing percent slope.

In ArcGIS, invert the standard black to white color ramp so that it's now showing white to black, and give it a pretty high transparency value. This adds a little bit of shading to steep slopes, which helps show off all the little nooks and crannies in the terrain:


TPI: Poor Man's Texture Shading
Texture shading was originally developed by Leland Brown and uses a fractional Laplacian operator to generate a raster that gives more of a "ridge and canyon" network feel (see the original paper for more info), with the side effect of calling out great little details if your elevation raster is clean enough/high-res enough.

The texture shading programs provided by Brown take a while to run, and struggle with large rasters. I've found I can get 80% of the way there with the GDAL Topographic Position Index tool: gdaldem TPI dem.tif out.tif. This poster gives more info about what TPI is, but for our purposes it outputs a great raster that can emphasize areas of abrupt topographic change—cliffs, ridges, canyon walls, and the like.

By using a black to white color ramp with the middle grays set to about 75% transparency (so they don't muddle things too much) and the whole layer set to about 80% transparency, this gives a subtle but noticeable improvement to the ridges and small details:


One of the tricks with TPI is that it's scale dependent. As the poster linked above describes, different window sizes give different results. GDAL's utility doesn't allow for changing the window. I'm working on a custom implementation that will allow you to fiddle with this parameter for analytic or artistic purposes.

So, do these additions make a map better? It depends on what you want to show. I like them, but I can see that some people may think it adds too much visual clutter.

Saturday, July 21, 2018

Wonderland Post 1

Last month I visited the Yellowstone area with some family. On this trip I discovered The Story of Man in Yellowstone, published in 1949 by Merril Beal. It gives a great (if aged) review of the recorded history of human (or at least non-Native American) exploration of the Yellowstone area. He calls the area Wonderland, which I think is great and I'm totally using from now on.

While reading this book, I had to constantly refer to a map because the landmarks Beal references were all mountains, rivers and lakes—there was no Norris Junction or Old Faithful Village in the early 1800s. I realized that my (and I imagine most everyone else's) mental map of Yellowstone is heavily influenced by the standard NPS park map.

This is no knock on the NPS map—it is a beautiful map that is fantastic at doing it's job (I'd love to chat with Tom Patterson someday about the NPS maps and terrain mapping). However, that job is to show you how to get to a very select group of relatively easily accessible attractions. Most mountains, mountain ranges, rivers, and lakes are buried deep in the visual hierarchy.

So, after all that intro, my goal with this map is to show the Wonderland that Colter (probably) saw, the Wonderland that the Folsom and Washburn expeditions later explored. I want to flip the NPS map's hierarchy. Natural features will be the focus, while man-made roads and arbitrarily-delineated attractions will fade into the background as reference points.

While we were visiting, we drove to the Grand Canyon of the Yellowstone. A sign between Norris and Canyon Village said we were crossing the caldera rim. While I could pull the NPS map out and see where the rim was, the terrain was so muted I had no way to relate that to what I was seeing out the window, or mentally zoom out and situate my experience into the physical area as a whole. This map should fix that.

Elevation

The first and most important part of the map is the underlying terrain. If we're going to talk about mountains and ridges, they'd better pop. Also, thanks to the caldera and other tectonic goodies that make the area what it is, there are some interesting stories to be told about the area. Existing maps just don't do these justice.

Elevation maps (hypsometric tints) are tough to do. You often see a kinda-natural-but-definitely-not color ramp, like on those giant roll-up physical relief wall maps at school (do schools still have those? I sure hope so, even if only so the current generation knows the frustration of trying to get one to roll back up). Or, you see some that try to be realistic as possible. Unfortunately, land cover is only partially determined by elevation, so this often strays into the uncanny valley.

For Wonderland, I chose to approach the uncanny valley head on, but I'm really pleased with the colors I finally came up with. I think they do a good job showing the elevation changes while sticking to a mountain forest color pallet. You can really see the uplands in the southwest part of the park, and how the caldera really dominates the center while the northern and eastern edges are more "traditional" mountainous areas.


I'm still playing around with the bright greens, but everything else is really working for me. This was the result of lots of little tweaks to the North America County San Bernardino 3 ramp from ESRI's Terrain Tools download.

Hillshade

Hillshading is another vital part of terrain maps, the thing that tweaks your brain into seeing mountains and valleys. I usually prefer to use the GDAL hillshade command with the combined option, which takes out a lot of the grays from the default algorithm. Because I'm focusing on the terrain, I chose a z scale of 5 to try to make it pop a little more.

The default 1/3 arc-second DEMs from the USGS can have lots of artifacts that aren't natural (look at the ripple effect along the gullies in the unsmoothed image below). To fix this, I smoothed the DEM using a DEM super-tool I've created and will probably write more about in the future. My first try is a Gaussian blur with a radius of 30 pixels (which is a different blur than the standard focal mean tool in ArcGIS, if I understand that tool correctly).

Comparing it to the unsmoothed image, I may try tightening the radius to preserve some of the edges. Or I may try some other cool smoothing techniques. We'll see.

Unsmoothed


Gaussian Blur, 30 Pixels


Finally for today, one oddity.

One of my biggest requests/hopes/desires/dreams for ArcGIS Pro is for different blend modes for each layer, instead of the standard transparency slider. This is especially useful for hillshade and elevation mashups like this, where a multiply mode would make my heart sing for joy (QGIS has it!).

I've heard rumblings that it may be in the long-term plan, but until then I seem to have a bug in my setup that does it for me already:

This image has the exact same settings as the ones above, just for some reason occasionally it draws weird. I have to turn different layers on and off before it reverts to what I'd expect.