# filters.nndistance

The NNDistance filter runs a 3-D nearest neighbor algorithm on the input cloud and creates a new dimension, `NNDistance`, that contains a distance metric described by the mode of the filter.

Default Embedded Stage

This stage is enabled by default

## Example

    [
        "input.las",
        {
            "type":"filters.nndistance",
            "k":8
        },
        {
            "type":"writers.bpf",
            "filename":"output.las",
            "output_dims":"X,Y,Z,NNDistance"
        }
    ]

## Options

mode

  The mode of operation. Either “kth”, in which the distance is the euclidian distance of the subject point from the kth remote point or “avg” in which the distance is the average euclidian distance from the k nearest points. [Default: ‘kth’]

k

  The number of k nearest neighbors to consider. [Default: 10]

where

  An expression that limits points passed to a filter. Points that don’t pass the expression skip the stage but are available to subsequent stages in a pipeline. [Default: no filtering]

where_merge

  A strategy for merging points skipped by a ‘where’ option when running in standard mode. If `true`, the skipped points are added to the first point view returned by the skipped filter. If `false`, skipped points are placed in their own point view. If `auto`, skipped points are merged into the returned point view provided that only one point view is returned and it has the same point count as it did when the filter was run. [Default: `auto`]