Shaded contour lines or Tanaka method with R

The following post, Tanaka method or how to make shaded contour lines on LandscapeArchaeology.org blog, explains clearly and thoroughly what shaded contour lines are and how to draw them with QGIS.
How hard would it be to implement this method with R?

From LandscapeArchaeology.org

This method is used to enhance the elevation visibility on raster images, so the first step consists in getting or building a raster image. Then we have to extract contour polygons. The last step consists in displaying successive layers of these contour polygons.

In this example I build a raster of the smoothed population density of Paris using IRIS units, which are a french sub-municipal statistical division.

Then I use the rasterToContourPoly() function from SpatialPosition to extract contour polygons based on the density raster.

I finally iterate over each levels of contour and plot three contour layers at each iteration: one with a north-west shift and a light color, a second with a south-east shift and a dark color, the third is plotted in place and colored according to the color palette.

Here is the final map on the smoothed population density in Paris:

You can find the full script used to build this map here.

The last map use the same technique on a more classical elevation dataset on Martinique.

Full script for this map here.


Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.