# filters.voxelcentroidnearestneighbor

The VoxelCentroidNearestNeighbor Filter is a voxel-based sampling filter. The input point cloud is divided into 3D voxels at the given cell size. For each populated voxel, we apply the following ruleset. For voxels with only one point, the point is passed through to the output. For voxels with exactly two points, the point closest the voxel center is returned. Finally, for voxels with more than two points, the centroid of the points within that voxel is computed. This centroid is used as the query point in a 3D nearest neighbor search (considering only those points lying within the voxel). The nearest neighbor is then added to the output point cloud, along with any existing dimensions.

Default Embedded Stage

This stage is enabled by default

## Example

    [
        "input.las",
        {
            "type":"filters.voxelcentroidnearestneighbor",
            "cell":10.0
        },
        "output.las"
    ]

See also

filters.voxelcenternearestneighbor offers a similar solution, using the voxel center as opposed to the voxel centroid for the query point.

## Options

cell

  Cell size in the `X`, `Y`, and `Z` dimension. [Default: 1.0]

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`]