Produce contours for a raster and return a vector dataset.

isoline_terra(x, line)

isoband_terra(x, lo, hi = NULL)

Arguments

x

a terra raster, only first layer is considered

line

a contour level for isoline_terra

lo

a polygon level interval minimum for the low values (must have a corresponding hi value)

hi

a polygon level interval maximum for the high values (cf. lo)

Value

SpatVector object, for isoline_terra a table of spatial lines with 'line' contour value, for isoband_terra a table of spatial polygons with 'lo' and 'hi' contour values

Details

isoline_terra returns lines, use 'line' to specify or an automatic set will be computed

isoband_terra returns polygons, use 'lo' AND 'hi' to specify breaks, or an automatic set will be computed

These lines and boundaries are nice because isoband uses marching squares, not literal pixel outlines.

Examples

isoline_terra(rast(volcano))
#>  class       : SpatVector 
#>  geometry    : lines 
#>  dimensions  : 7, 1  (geometries, attributes)
#>  extent      : 0.5, 60.5, 0.5, 84.7  (xmin, xmax, ymin, ymax)
#>  coord. ref. :  
#>  names       :  line
#>  type        : <int>
#>  values      :    80
#>                  100
#>                  120
isoband_terra(rast(volcano), lo = 100, hi = 150)
#>  class       : SpatVector 
#>  geometry    : polygons 
#>  dimensions  : 1, 2  (geometries, attributes)
#>  extent      : 0.5, 60.5, 0.5, 86.5  (xmin, xmax, ymin, ymax)
#>  coord. ref. :  
#>  names       :    lo    hi
#>  type        : <num> <num>
#>  values      :   100   150