# Combo Overlay

The Combo Overlay is a Grid Overlay which can be used to create additional spatial calculation models. Up to three input Overlays can be selected which serve as input for the calculations. A large set of functions and operators are available which can then perform the desired computations.

Combo Overlays can take any Grid Overlay as input. It is often combined with one or more Average Overlays or Travel Distance Overlays. The Combo Overlay can also use the results of more complex calculation models, such as the Water Overlay or the Heat Overlay to further process the computed results of those models. Finally, Combo Overlays can also refer to other Combo Overlays, to create even more powerful, varied, and complex spatial calculation models.

## Operators

In the table below are the operators displayed that are supported by the combo overlay. The term argument refers to a grid overlay configured as input, a numerical value or a global name.

Name | Arguments | Type | Displays |
---|---|---|---|

SIN | Single | Function | Sine function |

COS | Single | Function | Cosine function |

TAN | Single | Function | Tangent function |

ASIN | Single | Function | Arc sine function |

ACOS | Single | Function | Arc cosine function |

ATAN | Single | Function | Arc tangent function |

ROUND | Single | Function | Round function |

FLOOR | Single | Function | Floor function |

CEIL | Single | Function | Ceil function |

ABS | Single | Function | Absolute function |

EXP | Single | Function | Exponential function |

LN | Single | Function | The natural logarithm (base e) function |

LOG | Single | Function | The natural logarithm (base 10) function |

SQRT | Single | Function | The square root function |

RANDOM | Single | Function | The random function, which returns a number greater than or equal to 0.0 and less than the provided argument |

ERF | Single | Function | The gauss error function, for probability calculations. |

ADD | Multi | Operator | Add one or more argument |

MULT | Multi | Operator | Multiply one or more arguments |

SUB | Multi | Operator | Subtract one or more arguments from the first argument |

DIV | Multi | Operator | Divide the first argument with one or more other arguments |

MIN | Multi | Function | Returns the smallest of the provided arguments. That is, the result is the argument closest to negative infinity. |

MAX | Multi | Function | Returns the largest of the provided arguments. That is, the result is the argument closest to positive infinity. |

AVG | Multi | Function | Returns the arithmetic mean of the provided arguments. |

POW | Multi | Function | Raises the first argument to the power of the consecutive arguments. For example 2 to the power 3 to the power 4. |

IF | Multi | Function | Takes 3 arguments. If first argument is true (numerical value exactly 1), it returns the second argument, else it returns the third argument. |

AND | Multi | Boolean | Returns 1.0 if all arguments are not equal to 0.0. |

OR | Multi | Boolean | Returns 1.0 if any argument is not equal to 0.0. |

GTE | Pair | Boolean | Returns 1.0 if the first argument is larger than or equal to the second argument, else returns 0.0. |

GT | Pair | Boolean | Returns 1.0 if the first argument is larger than the second argument, else returns 0.0. |

LTE | Pair | Boolean | Returns 1.0 if the first argument is smaller than or equal to the second argument, else returns 0.0. |

LT | Pair | Boolean | Returns 1.0 if the first argument is smaller than the second argument, else returns 0.0. |

NEQ | Pair | Boolean | Returns 1.0 if the first argument is not equal to the second argument, else returns 0.0. |

EQ | Pair | Boolean | Returns 1.0 if the first argument is equal to second argument, else returns 0.0. |

PERCENTILE | Multi | Function | Calculates the linear interpolated k-th percentile (value between 0 and 1) of the sorted array of provided arguments. The last provided argument should be the percentile. |

AVG_GTE_PERCENTILE | Multi | Function | Calculates the average of the provided arguments which are above the calculated linear interpolated k-th percentile (value between 0 and 1). The last provided argument should be the percentile. |

AVG_LTE_PERCENTILE | Multi | Function | Calculates the average of the provided arguments which are below the calculated linear interpolated k-th percentile (value between 0 and 1). The last provided argument should be the percentile. |

NO_DATA | Constant | Constant | The NO_DATA value for grid data, indicating no data exists. |

## Inputs

- Up to ten Overlays can be configured as input for the Combo Overlay. These prequels are referenced as A, B, C, etc.
- You can use Globals in a formula.

### Timeframes

When an input Overlay has multiple Timeframes, additional syntax is available to specify the intended timeframes.

Timeframes are 0-indexed, meaning they start counting at 0. The first timeframe is 0, the second timeframe is 1, the tenth timeframe is 9, etc.

Syntax | Meaning | Example | Effect |
---|---|---|---|

A | The (last) value from Overlay A | MUL(A, 10) | Assuming:
- A is a Water Overlay with Surface Last Value as result type
Will show the height of the water at the end of the calculation in cm (rather than m). |

A2 | The third timeframe's value from Overlay A | GT(A2, 38) | Assuming:
- A is a Heat Overlay with Physiological Equivalent Temperature as result type
Will indicate whether any given location is (1) or is not (0) hotter than 38 °C, on the third computed timeframe of the Heat Overlay. |

A0:2 | The values from the first through third timeframes from Overlay A, as a list of inputs | AVG(A0:2) | Assuming:
- A is a Heat Overlay with Physiological Equivalent Temperature as result type
Will show the average of the computed temperatures of the first three timeframes of the Heat Overlay. |

AT | For each timeframe of the Combo Overlay, the value from that same timeframe from Overlay A, as individual inputs.
This will cause the Combo Overlay to have at least as many timeframes as Overlay A. |
MUL(AT, 10) | Assuming:
- A is a Water Overlay with Surface Last Value as result type
Will show the height of the water at each timeframe of the Water Overlay's calculations in cm (rather than m). |

A Combo Overlay automatically computes the amount of timeframes it requires, based on the following:

- The amount of timeframes of Input Overlays which are referenced in the formula using the T syntax.
- The amount of values in Globals which are referenced in the formula. (Globals are automatically interpreted as a Global array.)

The highest found value among all those dictates the amount of Timeframes the Combo Overlay has.

## Examples

- Combo Overlay with average overlays
- Combo Overlay with masking
- Combo Overlay with distance filtering
- How to adjust the height map with a combo overlay - an example for kerbs
- How to compute the presence of features of a particular size - an example for public green
- How to combine results of multiple Overlays as timeframes in a Combo Overlay
- How to compute cool locations of sufficient size
- Conditionally include grid information in Combo Overlay calculation: https://community.tygron.com/forum/discussion/551/conditionally-include-grid-information-in-a-combo-overlay-calculation
- Biodiversity analysis: bats (Dutch only):

## Notes

- When multiple input Overlays are referenced with a "T" syntax and those have varying amounts of timeframes, the maximum amount of timeframes among those input Overlays is used.
- When the "T" syntax is used to refer to an input Overlay with fewer timeframes than the Combo Overlay itself, any timeframe referenced via the "T" syntax beyond what the input Overlay offers uses whichever value the last timeframe of that input Overlay had. I.e. if a Water Overlay has 10 timeframes but the Combo Overlay attempts to compute an 11th timeframe and beyond, the value from the last (10th) timeframe of the Water Overlay is used.

## How-to's

- How to add and remove an Overlay
- How to edit a Combo Overlay's formula
- How to edit an overlay legend
- How to add and remove an Attribute