The goal of isoraster is to create contour lines and contour polygons from rasters.

The R terra package is used as a foundation. The R isoband package is the engine, sf is used as an intermediate format internally.

Installation

You can install the development version of isoraster like so:

remotes::install_github("mdsumner/isoraster")

Example

This is a basic example.

library(isoraster)
#> Loading required package: terra
#> terra 1.7.78


plot(isoline_terra(rast(volcano), seq(100, 170, by = 5)))


plot(isoband_terra(rast(volcano), c(100, 110, 120), c(110, 120, 130)))

Note that the lines are nice and smooth, because the underlying algorithm is marching squares in {isoband}, equivalent to R’s ‘contour()’.

dr <- aggregate(rast(volcano), 4)
plot(dr)
plot(isoband_terra(dr, c(120, 130, 160), c(130, 160, 170)), add = TRUE)

Code of Conduct

Please note that the isoraster project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.