I'm working on improved hillshading for some topographical map plots. The basic hillshade workflow documented in image()
is:
require(raster)
alt = getData('alt', country='CHE')
slope = terrain(alt, opt='slope')
aspect = terrain(alt, opt='aspect')
hill = hillShade(slope, aspect, 40, 270)
plot(hill, col=grey(0:100/100), legend=FALSE, main='Switzerland')
plot(alt, col=rainbow(25, alpha=0.35), add=TRUE)
This image shows plot(hill..)
before plot(alt..)
is applied:
The method creates a solid grey under-layer of hillshades on which other data layers (e.g. elevation shading) are plotted semi-transparently. The problem with this approach is (a) that the neutral colour for flat terrain (RBG (202,202,202), '#CACACA') severely shades the whole model, which (b) prevents multiple shade layering, such as used by the 'Swiss hillshade' approach.
I can imagine an workaround that converts rasters to matrices and applies hillshading as a numerical multiplier to the brightness of other layers, but this doesn't seem very elegant (although I may be wrong). I wonder if anyone has any ideas or (preferably) experience in this area? Thanks in advance.