# filters.assign

The assign filter allows you set the value of a dimension for all points to a provided value that pass a range filter.

Default Embedded Stage

This stage is enabled by default

Streamable Stage

This stage supports streaming operations

Note

The assignment and condition options are deprecated and may be removed in a future release.

## Options

assignment

  A range followed by an assignment of a value (see example). Can be specified multiple times. The assignments are applied sequentially to the dimension value as set when the filter began processing. [Required]

condition

  A single ranges that a point’s values must pass in order for the assignment to be performed. [Default: none] [Deprecated - use ‘value’]

value

  A list of assignment expressions to be applied to points. The list of values is evaluated in order. [Default: none]

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

# Assignment Expressions

The assignment expression syntax is an expansion on the Expression Syntax syntax that provides for assignment of values to points. The generic expression is:

    "value" : "Dimension = ValueExpression [WHERE ConditionalExpression)]"

`Dimension` is the name of a PDAL dimension.

A `ValueExpression` consists of constants, dimension names and mathematical operators that evaluates to a numeric value. The supported mathematical operations are addition(+), subtraction(-), multiplication(*) and division(\).

A ConditionalExpression is an optional boolean value that must evaluate to true for the `ValueExpression` to be applied.

# Example 1

    "value" : "Red = Red / 256"

This scales the `Red` value by 1/256. If the input values are in the range 0 - 65535, the output value will be in the range 0 - 255.

# Example 2

    "value" :
    [
        "Classification = 2 WHERE HeightAboveGround < 5",
        "Classification = 1 WHERE HeightAboveGround >= 5"
    ]

This sets the classification of points to either `Ground` or `Unassigned` depending on the value of the `HeightAboveGround` dimension.

# Example 3

    "value" :
    [
        "X = 1",
        "X = 2 WHERE X > 10"
    ]

This sets the value of `X` for all points to 1. The second statement is essentially ignored since the first statement sets the `X` value of all points to 1 and therefore no points the `ConditionalExpression` of the second statement.