Skip to content

Documentation / @interstellar-tools/maps / aspectGrid

Function: aspectGrid() ​

ts
function aspectGrid(grid: GridInterface): GridInterface;

Defined in: terrain/aspect.ts:85

Compute the aspect of every cell of an elevation grid, as a new grid in radians clockwise from north.

See aspectAt. Flat cells, cells on the edge and cells next to a missing cell are NaN.

Parameters ​

ParameterTypeDescription
gridGridInterfaceElevation grid, heights in m.

Returns ​

GridInterface

A grid of the same shape, aspects in radians.

Throws ​

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

Example ​

ts
const aspects = aspectGrid(grid);
gridValueAt(aspects, 1, 1); // 3π/2

See ​

aspectAt