## Transformation - InterpolationSpatial Closest Distance

schema: | |

keywords: | transformation, spatial interpolation, closest distance |

##### Description and usage

This transformation function finds the closest location/grid cell in the input time series and uses the value of that location/grid cell for the output.

This transformation can handle three types of input:

- scalar
- regular grid
- irregular grid
- longitudinal profile

The output can be a:

- scalar
- regular grid
- irregular grid
- longitudinal profile

If the time series is not a scalar time series the centre of the grid cell will be used when trying to find the closest input location/grid cell.

When a longitudinal profile is used the profile is considered to be a scattered grid.

The configurator has the possibility to configure a minimum and maximum value for the output. If the output exceeds the minimum or maximum value the output is truncated to that value.

It is also possible to maximize the search radius in which the transformation searches for the closest input location/grid cell. This can be done by setting the searchRadius in the configuration.

##### Input/Output time series

In this function one input time series and one output time series must be identified.

- inputVariable: a time series with input values. This can be a scalar time series, longitudinal profile or a time series with a regular/irregular grid.
- outputVariable: a time series in which the output will be stored. This can be a scalar time series, longitudinal profile or a time series with a regular/irregular grid.

##### Configuration

A basic configuration of the function is described below. This describes the main elements and attributes required and provides an example configuration.

*inputVariable*

Required element defining the identifier of the input time series with input values. This Id must reference a valid input time series.

*outputVariable*

Required element defining the identifier of the output time series with output values. This Id must reference a valid output time series.

*minimumValue*

Optional element defining the minimum value of the output time series. If the output value is lower than the configured minimum value the output value will be equal to the configured minimum value.

*maximumValue*

Optional element defining the maximum value of the input time series. If the output value is higher than the configured maximum value the output value will be equal to the configured maximum value.

*searchRadius*

Optional element defining the maximum radius in which the transformation searches the closest location/grid cell.

*overrulingXAttribute*

Optional element available since 2017.02. If defined, the x-coordinates for both the input and the output locations will be overruled by the attribute value if it is present for that location. If no attribute value is found, the regular x-coordinate is used. The attribute values are expected to use the same geoDatum as the location's coordinates.

*overrulingYAttribute*

Optional element available since 2017.02. If defined, the y-coordinates for both the input and the output locations will be overruled by the attribute value if it is present for that location. If no attribute value is found, the regular y-coordinate is used. The attribute values are expected to use the same geoDatum as the location's coordinates.

*distanceGeoDatum*

Geo datum used to calculate the distances in meters between the points. To calculate distances efficiently and to pre-sort the input points in a grid the earth's curved surface should be transformed to a flat two-dimensional surface. When the input geometry is not in meters calculation of distances will be very slow and a search all is required when there is no exact match. When there is no region/country specific coordinate system available choose a utm zone that best fits with your output region. http://en.wikipedia.org/wiki/File:Utm-zones.jpg. eg. UTM55S for Victoria state in Australia. Only use zone number and N for northern hemisphere and S for southern hemisphere

*Example*

<interpolationSpatial> <closestDistance> <inputVariable> <variableId>input</variableId> </inputVariable> <minimumValue>0</minimumValue> <maximumValue>1000</maximumValue> <searchRadius>10000</searchRadius> <outputVariable> <variableId>output</variableId> </outputVariable> </closestDistance> </interpolationSpatial>

##### Common issues

None reported.