Skip to contents

Terrain Ruggedness Index is a measurement developed by Riley, et al. (1999). The elevation difference between the centre pixel and its eight immediate pixels are squared and then averaged and its square root is taken to get the TRI value. This function allows to efficiently calculate terrain ruggedness index (tri) statistics for polygons. For each polygon, the desired statistic/s (mean, median or sd) is/are returned. The required resources for this indicator are:

Format

A tibble with a column for terrain ruggedness index statistics (in meters). The range of index values and corresponding meaning: (1) 0 - 80 m :- level surface (2) 81-116 m :- nearly level surface (3) 117-161 m :- slightly rugged surface (4) 162-239 m :- intermediately rugged surface (5) 240-497 m :- moderately rugged surface (6) 498-958 m :- highly rugged surface (7) 959-4367 m:- extremely rugged surface

Details

The following arguments can be set:

stats_tri

Function to be applied to compute statistics for polygons either single or multiple inputs as character. Supported statistics are: "mean", "median", "sd", "min", "max", "sum" "var".

engine

The preferred processing functions from either one of "zonal", "extract" or "exactextract" as character.

References

Riley, S. J., DeGloria, S. D., & Elliot, R. (1999). Index that quantifies topographic heterogeneity. intermountain Journal of sciences, 5(1-4), 23-27.

Examples

# \dontshow{
mapme.biodiversity:::.copy_resource_dir(file.path(tempdir(), "mapme-data"))
# }
# \dontrun{
library(sf)
library(mapme.biodiversity)

outdir <- file.path(tempdir(), "mapme-data")
dir.create(outdir, showWarnings = FALSE)

aoi <- system.file("extdata", "sierra_de_neiba_478140_2.gpkg",
  package = "mapme.biodiversity"
) %>%
  read_sf() %>%
  init_portfolio(
    years = 2000:2020,
    outdir = outdir,
    tmpdir = tempdir(),
    verbose = FALSE
  ) %>%
  get_resources("nasa_srtm") %>%
  calc_indicators("tri", stats_tri = c("mean", "median", "sd", "var"), engine = "extract") %>%
  tidyr::unnest(tri)

aoi
#> Simple feature collection with 1 feature and 9 fields
#> Geometry type: POLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -71.80933 ymin: 18.57668 xmax: -71.33201 ymax: 18.69931
#> Geodetic CRS:  WGS 84
#> # A tibble: 1 × 10
#>   WDPAID NAME         DESIG_ENG ISO3  assetid tri_mean tri_median tri_sd tri_var
#>    <dbl> <chr>        <chr>     <chr>   <int>    <dbl>      <dbl>  <dbl>   <dbl>
#> 1 478140 Sierra de N… National… DOM         1     33.3       30.8   18.7    349.
#> # ℹ 1 more variable: geom <POLYGON [°]>
# }