# Calc Flow Direction Map

## Description

This functor calculates a flow direction map using an elevation map.

## Inputs

Name | Type | Description |
---|---|---|

Elevation | Map Type | Elevation map. The elevation unit is not relevant. |

## Optional Inputs

Name | Type | Description | Default Value |
---|---|---|---|

Diagonals Are Longer | Boolean Value Type | If true, the flow between diagonal cells is attenuated by the square root of two. | True |

Return All Directions | Boolean Value Type | If true, the functor returns the flow directions leaving a cell packed as a bitwise-OR combination of all possible directions. | False |

Use Lottery | Boolean Value Type | If true, the functor chooses randomly between possible directions. This flag only makes sense if the flag “Return All Directions” is false. | False |

Flow Also In Flat Areas | Boolean Value Type | If true, this functor also calculates flow direction for flat areas (zero slope cells). It is worth noting that, if a cell has eight neighbors with the same elevation, but at least one has flow direction, the flow will point toward that cell. | True |

Flow Direction Is Sparse | Boolean Value Type | If true, the map is loaded as a sparse image. Sparse images have the advantage of storing only the cells containing non-null values, but they have worse access time. | False |

## Outputs

Name | Type | Description |
---|---|---|

Flow Directions | Map Type | Flow direction map. Every non-null cell from this map contains a value indicating the direction toward the steepest slope (or the bit-wised combination of all possible directions, whether “Return All Directions” is true). |

## Group

## Notes

Null value elevation cells are ignored.

The values in the output map indicate the directions as follows:

32 | 64 | 128 |

16 | x | 1 |

8 | 4 | 2 |

where X is the current cell and the other cells indicate their corresponding position mask.

The resulting directions can be summed to pack several directions in a single value.

## Internal Name

CalcFlowDirectionMap