# Compute Distance Raster from Raster

## Overview

The Compute Distance Raster from Raster process is used to create a distance and direction raster. A distance raster has cell values that represent the distance from features of interest in the input raster. Cell values in the direction raster indicate the direction towards the closest feature of interest relative to that cell location.

Features of interest are specified by cell value. An extra "margin" can be added to extend the output beyond the input raster dimensions. Output Distance Units can be specified in cells or map units.

## Try It

Prerequisite Skills: Displaying Geospatial Data and TNT Product Concepts.

Sample Data: the stanton_class.rvc file in stanton.zip

Tutorial Lesson: The exercise below provides an introduction.

#### Exercise – Run Compute Distance Raster from Raster

To run the process: load the input raster, set the cell value, and run.

1. select Image > Spatial Analysis > Compute Distance Raster from Raster from the TNTmips menu bar
2. click the Select button and add the stanton_class.rvc / CLS_MinDistance raster
3. set the Cell Value, Equal to Value: 8 with a Margin: 0 cells
4. in the Distance panel, set Distance Units to cells
5. if different, set Cell Type: 32–bit floating point, Distance Units: cells
6. optionally create a direction raster — in the Direction panel set Cell Type: 32–bit floating point, Orient:Clockwise from Raster Top (leave Cell Type: None if you do not want to create a direction raster)

## Input

The process can take any raster data type as input (binary, signed/unsigned integer: 8-, 16-, and 32-bit; floating: 32- and 64-bit). The process requires the user to enter a cell value to specify the feature of interest.

## Results & Output

The process outputs a distance raster and optionally a direction raster for every input rasters. Output rasters can be 32– or 64–bit data type. You have the option of setting a color palette to use when displaying it.

distance raster – has cell values specifying the distance to the nearest feature of interest.

direction raster – has cell values that specify the direction (0 to 360 degrees) towards the nearest feature of interest.

## Interface

The Compute Distance Raster from Raster is the main window used in the process.

### Input pane

Options here are used to select input and specify the feature of interest in it:

Select button – select input.

Remove, Remove All buttons – remove previously selected input.

Clear after run toggle – clears input after running when on.

Cell Value – choose the method and cell value to specify the feature of interest. Methods include: Equal to Value, Not Equal to Value, Null, and Non-Null.

Margin – add a margin around the raster to increase the output extents.

### Distance pane

Options here are used to create a distance raster:

Cell Type – 32– or 64–bit.

Distance Units – for output cell values are in the number of cells or a conventional unit of measurement (i.e. meters, kilometers).

Palette – menu to select color palette. The Choose option opens the Select Palette window. For best results, a cyclic palette is recommended to make the color changes continuous.

Reversed toggle – invert the color palette.

### Direction pane

Options here are used to create a direction raster:

Cell Type – 32– or 64–bit rasters as above, plus the None option to not make the direction raster.

Orient – determines the position cell value start at 0 and move towards 360 (degrees) in the clockwise direction. Choices are: Clockwise from Raster Top, Clockwise from Projection North, Counter–Clockwise from Raster Right, and Counter–Clockwise from Projection East.

Note, the cell value indicates the direction from the cell towards the closest features. For example, when Orient is set to Clockwise from Raster Top, 0 indicates the feature is above and 180 mean it is below.

Palette – menu to select color palette. The Choose option opens the Select Palette window. For best results, a cyclic palette is recommended to make the color changes continuous.

Reversed toggle – invert the color palette.