Package 'tanaka'

Title: Design Shaded Contour Lines (or Tanaka) Maps
Description: The Tanaka method enhances the representation of topography on a map using shaded contour lines. In this simplified implementation of the method, north-west white contours represent illuminated topography and south-east black contours represent shaded topography. See Tanaka (1950) <doi:10.2307/211219>.
Authors: Timothée Giraud [cre, aut]
Maintainer: Timothée Giraud <[email protected]>
License: GPL-3
Version: 0.4.0
Built: 2024-11-22 03:05:36 UTC
Source: https://github.com/riatelab/tanaka

Help Index


Tanaka Contours Package

Description

The tanaka package is a simplified implementation of the Tanaka method. Also called "relief contours method", "illuminated contour method", or "shaded contour lines method", the Tanaka method enhances the representation of topography on a map using shaded contour lines. North-west white contours represent illuminated topography and south-east black contours represent shaded topography.


Plot a Tanaka Map

Description

This function plots a tanaka map.

Usage

tanaka(
  x,
  nclass = 8,
  breaks,
  col,
  mask,
  light = "#ffffff70",
  dark = "#00000090",
  shift,
  legend.pos = "left",
  legend.title = "Elevation",
  add = FALSE
)

Arguments

x

a raster or an sf contour layer (e.g. the result of tanaka_contour(), "min" and "max" columns are needed).

nclass

a number of class.

breaks

a vector of break values.

col

a color palette (a vector of colors).

mask

a mask layer, a POLYGON or MULTIPOLYGON sf object.

light

light shadow (NW color).

dark

dark shadow (SE color).

shift

size of the shadow (in map units).

legend.pos

position of the legend, one of 'topleft', 'top', 'topright', 'right', 'bottomright', 'bottom', 'bottomleft', 'left' or a vector of two coordinates in map units (c(x, y)). If leg.position = NA then the legend is not plotted. If leg.position = 'interactive' click on the map to choose the legend position.

legend.title

title of the legend.

add

whether to add the layer to an existing plot (TRUE) or not (FALSE).

Value

A Tanaka contour map is plotted.

References

Tanaka, K. (1950). The relief contour method of representing topography on maps. Geographical Review, 40(3), 444-456.

Examples

library(tanaka)
library(terra)
library(sf)
com <- st_read(system.file("gpkg/com.gpkg", package = "tanaka"),
  quiet = TRUE
)
ras <- rast(system.file("tif/elev.tif", package = "tanaka"))
tanaka(ras)
tanaka(ras, mask = com)
tanaka(ras,
  breaks = seq(80, 400, 20),
  legend.pos = "topright",
  legend.title = "Elevation\n(meters)"
)
tanaka(ras,
  nclass = 15,
  col = hcl.colors(15, "YlOrRd"),
  legend.pos = "topright",
  legend.title = "Elevation\n(meters)"
)

Create a Contour Layer

Description

Create a contour layer.

Usage

tanaka_contour(x, nclass = 8, breaks, mask)

Arguments

x

a raster object.

nclass

a number of class.

breaks

a vector of break values.

mask

a mask layer, a POLYGON or MULTIPOLYGON sf object.

Value

A MULTIPOLYGON sf object is return. The data.frame contains 3 fields: id, min (minimum value of the raster in the MULTIPOLYGON) and max (maximum value of the raster in the MULTIPOLYGON).

Examples

library(tanaka)
library(terra)
library(sf)
ras <- rast(system.file("tif/elev.tif", package = "tanaka"))
iso <- tanaka_contour(x = ras)
plot(st_geometry(iso), col = c(
  "#FBDEE1", "#F0BFC3", "#E7A1A6",
  "#DD8287", "#D05A60", "#C03239",
  "#721B20", "#1D0809"
))