# Filters¶

Filters operate on data as inline operations. They can remove, modify, reorganize, and add points to the data stream as it goes by. Some filters can only operate on dimensions they understand (consider filters.reprojection doing geographic reprojection on XYZ coordinates), while others do not interrogate the point data at all and simply reorganize or split data.

## Create¶

PDAL filters commonly create new dimensions (e.g., `HeightAboveGround`

) or
alter existing ones (e.g., `Classification`

). These filters will not
invalidate an existing KD-tree.

Note

We treat those filters that alter XYZ coordinates separately.

Note

When creating new dimensions, be mindful of the writer you are using and whether or not the custom dimension can be written to disk if that is the desired behavior.

- filters.approximatecoplanar
- Estimate pointwise planarity, based on k-nearest neighbors. Returns a new
dimension
`Coplanar`

where a value of 1 indicates that a point is part of a coplanar neighborhood (0 otherwise). - filters.assign
- Assign values for a dimension range to a specified value.
- filters.cluster
- Extract and label clusters using Euclidean distance metric. Returns a new
dimension
`ClusterID`

that indicates the cluster that a point belongs to. Points not belonging to a cluster are given a cluster ID of 0. - filters.colorinterp
- Assign RGB colors based on a dimension and a ramp
- filters.colorization
- Fetch and assign RGB color information from a GDAL-readable datasource.
- filters.eigenvalues
- Compute pointwise eigenvalues, based on k-nearest neighbors.
- filters.estimaterank
- Compute pointwise rank, based on k-nearest neighbors.
- filters.elm
- Marks low points as noise.
- filters.ferry
- Copy data from one dimension to another.
- filters.hag
- Compute pointwise height above ground estimate. Requires points to be classified as ground/non-ground prior to estimating.
- filters.kdistance
- Compute pointwise K-Distance (the Euclidean distance to a point’s k-th nearest neighbor). [Deprecated - use filters.nndistance]
- filters.lof
- Compute pointwise Local Outlier Factor (along with K-Distance and Local Reachability Distance).
- filters.mongus
- Label ground/non-ground returns using [Mongus2012].
- filters.neighborclassifier
- Update pointwise classification using k-nearest neighbor consensus voting.
- filters.nndistance
- Compute a distance metric based on nearest neighbors.
- filters.normal
- Compute pointwise normal and curvature, based on k-nearest neighbors.
- filters.outlier
- Label noise points using either a statistical or radius outlier detection.
- filters.overlay
- Assign values to a dimension based on the extent of an OGR-readable data source or an OGR SQL query.
- filters.pmf
- Label ground/non-ground returns using [Zhang2003].
- filters.radialdensity
- Compute pointwise density of points within a given radius.
- filters.smrf
- Label ground/non-ground returns using [Pingel2013].

## Order¶

There are currently three PDAL filters that can be used to reorder points. These filters will invalidate an existing KD-tree.

- filters.mortonorder
- Sort XY data using Morton ordering (aka Z-order/Z-curve).
- filters.randomize
- Randomize points in a view.
- filters.sort
- Sort data based on a given dimension.

## Move¶

PDAL filters that move XYZ coordinates will invalidate an existing KD-tree.

- filters.cpd
- Compute and apply transformation between two point clouds using the Coherent Point Drift algorithm.
- filters.icp
- Compute and apply transformation between two point clouds using the Iterative Closest Point algorithm.
- filters.reprojection
- Reproject data using GDAL from one coordinate system to another.
- filters.transformation
- Transform each point using a 4x4 transformation matrix.

## Cull¶

Some PDAL filters will cull points, returning a point cloud that is smaller than the input. These filters will invalidate an existing KD-tree.

- filters.crop
- Filter points inside or outside a bounding box or a polygon
- filters.decimation
- Keep every Nth point.
- filters.dem
- Remove points that are in a raster cell but have a value far from the value of the raster.
- filters.head
- Return N points from beginning of the point cloud.
- filters.iqr
- Cull points falling outside the computed Interquartile Range for a given dimension.
- filters.locate
- Return a single point with min/max value in the named dimension.
- filters.mad
- Cull points falling outside the computed Median Absolute Deviation for a given dimension.
- filters.range
- Pass only points given a dimension/range.
- filters.sample
- Perform Poisson sampling and return only a subset of the input points.
- filters.tail
- Return N points from end of the point cloud.
- filters.voxelcenternearestneighbor
- Return the point within each voxel that is nearest the voxel center.
- filters.voxelcentroidnearestneighbor
- Return the point within each voxel that is nearest the voxel centroid.

## New¶

PDAL filters can be used to split the incoming point cloud into subsets. These filters will invalidate an existing KD-tree.

- filters.chipper
- Organize points into spatially contiguous, squarish, and non-overlapping chips.
- filters.divider
- Divide points into approximately equal sized groups based on a simple scheme.
- filters.groupby
- Split data categorically by dimension.
- filters.returns
- Split data by return order (e.g., ‘first’, ‘last’, ‘intermediate’, ‘only’).
- filters.splitter
- Split data based on a X/Y box length.

## Join¶

Multiple point clouds can be joined to form a single point cloud. These filters will invalidate an existing KD-tree.

- filters.merge
- Merge data from two different readers into a single stream.

## Metadata¶

PDAL filters can be used to create new metadata. These filters will not invalidate an existing KD-tree.

Note

filters.cpd and filters.icp can optionally create metadata as well, inserting the computed transformation matrix.

- filters.hexbin
- Tessellate XY domain and determine point density and/or point boundary.
- filters.info
- Generate metadata about the point set, including a point count and spatial reference information.
- filters.stats
- Compute statistics about each dimension (mean, min, max, etc.).

## Mesh¶

Meshes can be computed from point clouds. These filters will invalidate an existing KD-tree.

- filters.delaunay
- Create mesh using Delaunay triangulation.
- filters.greedyprojection
- Create mesh using the Greedy Projection Triangulation approach.
- filters.gridprojection
- Create mesh using the Grid Projection approach [Li2010].
- filters.movingleastsquares
- Data smoothing and normal estimation using the approach of [Alexa2003].
- filters.poisson
- Create mesh using the Poisson surface reconstruction algorithm [Kazhdan2006].

## Languages¶

PDAL has two filters than can be used to pass point clouds to other languages. These filters will invalidate an existing KD-tree.

- filters.matlab
- Embed MATLAB software in a pipeline.
- filters.pclblock
- Embed select PCL filters in a pipeline.
- filters.python
- Embed Python software in a pipeline.

## Other¶

- filters.streamcallback
- Provide a hook for a simple point-by-point callback.
- filters.voxelgrid
- Create a new point cloud composed of voxel centroids computed from the input point cloud. All incoming dimension data (e.g., intensity, RGB) will be lost.