Skip to content

Documentation / @interstellar-tools/maps / terrainRoughnessIndexGrid

Function: terrainRoughnessIndexGrid() ​

ts
function terrainRoughnessIndexGrid(grid: GridInterface): GridInterface;

Defined in: terrain/terrain-roughness-index.ts:92

Compute the Terrain Roughness Index of every cell of an elevation grid, as a new grid in metres.

See terrainRoughnessIndexAt. Cells on the edge and next to a missing cell are NaN.

Parameters ​

ParameterTypeDescription
gridGridInterfaceElevation grid, heights in m.

Returns ​

GridInterface

A grid of the same shape, TRI in m.

Throws ​

  • If a size or cell size is not finite.
  • If the grid's parts don't fit together.

Example ​

ts
const roughness = terrainRoughnessIndexGrid(grid);
gridValueAt(roughness, 1, 1); // 2

See ​

terrainRoughnessIndexAt