# 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.

### Classification#

#### Ground/Unclassified#

- filters.csf
Label ground/non-ground returns using [Zhang

*et al.*, 2016].- filters.pmf
Label ground/non-ground returns using [Zhang

*et al.*, 2003].- filters.skewnessbalancing
Label ground/non-ground returns using [Bartels and Wei, 2010].

- filters.smrf
Label ground/non-ground returns using [Pingel

*et al.*, 2013].- filters.sparsesurface
Sparsify ground returns and label neighbors as low noise.

- filters.trajectory
Label ground/non-ground returns using estimate flight trajectory given multi-return point cloud data with timing information.

#### Noise#

- filters.elm
Marks low points as noise.

- filters.outlier
Label noise points using either a statistical or radius outlier detection.

#### Consensus#

- filters.neighborclassifier
Update pointwise classification using k-nearest neighbor consensus voting.

### Height Above Ground#

- filters.hag_delaunay
Compute pointwise height above ground using triangulation. Requires points to classified as ground/non-ground prior to estimating.

- filters.hag_dem
Compute pointwise height above GDAL-readable DEM raster.

- filters.hag_nn
Compute pointwise height above ground estimate. Requires points to be classified as ground/non-ground prior to estimating.

### Colorization#

- 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.

### Clustering#

- 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.dbscan
Perform Density-Based Spatial Clustering of Applications with Noise (DBSCAN) [Ester

*et al.*, 1996].- filters.litree
Segment and label individual trees. Returns a new dimension

`TreeID`

that indicates the tree that a point belongs to.`TreeID`

starts at 1, with non-tree points given a`TreeID`

of 0. [Li*et al.*, 2012].- filters.lloydkmeans
Perform K-means clustering using Lloyd’s algorithm. Returns a new dimension

`ClusterID`

with each point being assigned to a cluster.`ClusterID`

starts at 0. [Lloyd, 1982].

### Pointwise Features#

- 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.covariancefeatures
Filter that calculates local features based on the covariance matrix of a point’s neighborhood.

- filters.eigenvalues
Compute pointwise eigenvalues, based on k-nearest neighbors.

- filters.estimaterank
Compute pointwise rank, based on k-nearest neighbors.

- filters.label_duplicates
Label points as duplicate if the specified dimensions are equal.

- filters.lof
Compute pointwise Local Outlier Factor (along with K-Distance and Local Reachability Distance).

- filters.miniball
Compute a criterion for point neighbors based on the miniball algorithm.

- filters.nndistance
Compute a distance metric based on nearest neighbors.

- filters.normal
Compute pointwise normal and curvature, based on k-nearest neighbors.

- filters.optimalneighborhood
Compute optimal k nearest neighbors and corresponding radius by minimizing pointwise eigenentropy. Creates two new dimensions

`OptimalKNN`

and`OptimalRadius`

.- filters.planefit
Compute a deviation of a point from a manifold approximating its neighbors.

- filters.radialdensity
Compute pointwise density of points within a given radius.

- filters.reciprocity
Compute the percentage of points that are considered uni-directional neighbors of a point.

- filters.zsmooth
Compute a smoothed ‘Z’ value based on the ‘Z’ value of neighboring points.

- filters.griddecimation
Assign values for one point (the highest or lowest) per cell of a 2d regular grid.

### Assignment#

- filters.assign
Assign values for a dimension range to a specified value.

- filters.overlay
Assign values to a dimension based on the extent of an OGR-readable data source or an OGR SQL query.

### Dimension Create/Copy#

- filters.ferry
Copy data from one dimension to another.

## 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.

### Registration#

- 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.teaser
Compute a rigid transformation between two point clouds using the teaser algorithm.

### Predefined#

- filters.projpipeline
Apply coordinates operation on point triplets, based on PROJ pipeline string, WKT2 coordinates operations or URN definitions.

- filters.reprojection
Reproject data using GDAL from one coordinate system to another.

- filters.transformation
Transform each point using a 4x4 transformation matrix.

- filters.straighten
Transforms each in a new parametric coordinate system along a given poyline.

- filters.georeference
Georeference point cloud.

- filters.h3
Compute H3 index values for the Longitude/Latitude of the point cloud

## 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.

### Spatial#

- filters.crop
Filter points inside or outside a bounding box or a polygon

- filters.geomdistance
Compute 2D distance from a polygon to points

### Resampling#

- filters.decimation
Keep every Nth point.

- filters.fps
The Farthest Point Sampling Filter adds points from the input to the output PointView one at a time by selecting the point from the input cloud that is farthest from any point currently in the output.

- filters.relaxationdartthrowing
Relaxation dart throwing is a hierarchical variant of Poisson disk sampling, shrinking the minimum radius between iterations until the target number of output points is achieved.

- filters.sample
Perform Poisson sampling and return only a subset of the input points.

### Conditional#

- filters.dem
Remove points that are in a raster cell but have a value far from the value of the raster.

- filters.iqr
Cull points falling outside the computed Interquartile Range for a given dimension.

- filters.mad
Cull points falling outside the computed Median Absolute Deviation for a given dimension.

### Voxel#

- 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.

- filters.voxeldownsize
Retain either first point detected in each voxel or center of a populated voxel, depending on mode argument.

### Position#

- filters.expression
Pass only points given an expression

- filters.head
Return N points from beginning of the point cloud.

- filters.locate
Return a single point with min/max value in the named dimension.

- filters.mongo
Cull points using MongoDB-style expression syntax.

- filters.range
Pass only points given a dimension/range.

- filters.tail
Return N points from end of the point cloud.

## New#

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

### Spatial#

- 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.splitter
Split data based on a X/Y box length.

### Dimension#

- filters.gpstimeconvert
Convert between three LAS format GPS time standards

- filters.groupby
Split data categorically by dimension.

- filters.returns
Split data by return order (e.g., ‘first’, ‘last’, ‘intermediate’, ‘only’).

- filters.separatescanline
Split data based on scan lines.

## 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.).

- filters.expressionstats
Apply expressions for a given dimension and summarize counts

## 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.poisson
Create mesh using the Poisson surface reconstruction algorithm [Kazhdan

*et al.*, 2006].- filters.faceraster
Create a raster from an existing triangulation.

## Languages#

PDAL has three 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.python
Embed Python software in a pipeline.

- filters.julia
Embed Julia software in a pipeline.

## Other#

- filters.streamcallback
Provide a hook for a simple point-by-point callback.