Buffer expressions

The Create Buffers and Reconstruct Tracks tools can apply buffers based on an expression. Buffer expressions can be straightforward, such as = Field1 + 10, or much more complicated.

Buffer expressions must start with an equal sign (=). The buffer expression is applied to each feature in the dataset, where each feature may have a unique buffer distance. The following table explains the available functions:

Buffer expression functions

Function

Description

as_meters()

Applies a calculation assuming the input values are in meters.

Syntax: as_meters( <value> )

<value> is one of the following:

  • A numeric field. If there is a space in the field name, use square brackets.
  • A number.

Examples:

  • as_meters(distance)
  • as_meters(['Store dist'])
  • as_meters(10)

as_kilometers()

Applies a calculation assuming the input values are in kilometers.

Syntax: as_kilometers( <value> )

<value> is one of the following:

  • A numeric field. If there is a space in the field name, use square brackets.
  • A number.

Examples:

  • as_kilometers(distance)
  • as_kilometers(['Store dist'])
  • as_kilometers(10)

as_feet()

Applies a calculation assuming the input values are in feet.

Syntax: as_feet( <value> )

<value> is one of the following:

  • A numeric field. If there is a space in the field name, use square brackets.
  • A number.

Examples:

  • as_feet(distance)
  • as_feet(['Store dist'])
  • as_feet(10)

as_yards()

Applies a calculation assuming the input values are in yards.

Syntax: as_yards( <value> )

<value> is one of the following:

  • A numeric field. If there is a space in the field name, use square brackets.
  • A number.

Examples:

  • as_yards(distance)
  • as_yards(['Store dist'])
  • as_yards(10)

as_nautical_miles()

Applies a calculation assuming the input values are in nautical miles.

Syntax: as_nautical_miles( <value> )

<value> is one of the following:

  • A numeric field. If there is a space in the field name, use square brackets.
  • A number.

Examples:

  • as_nautical_miles(distance)
  • as_nautical_miles(['Store dist'])
  • as_nautical_miles(10)

abs()

Returns the absolute (positive) value of the input.

Syntax: abs( <value> )

<value> is one of the following:

  • A numeric field. If there is a space in the field name, use square brackets.
  • A number.

Examples:

  • abs(distance)
  • abs(['Store dist'])
  • abs(10)

log()

Returns the natural logarithm (base E) of the input.

Syntax: log( <value> )

<value> is one of the following:

  • A numeric field. If there is a space in the field name, use square brackets.
  • A number.

Examples:

  • log(distance)
  • log(['Store dist'])
  • log(10)

sin()

Returns the trigonometric sine of the input value. The input is assumed to be an angle in radians.

Syntax: sin( <value> )

<value> is one of the following:

  • A numeric field. If there is a space in the field name, use square brackets.
  • A number.

Examples:

  • sin(radValue)
  • sin(['Sun ang'])
  • sin(1)

cos()

Returns the trigonometric cosine of the input value. The input is assumed to be an angle in radians.

Syntax: cos( <value> )

<value> is one of the following:

  • A numeric field. If there is a space in the field name, use square brackets.
  • A number.

Examples:

  • cos(radValue)
  • cos(['Sun ang'])
  • cos(1)

tan()

Returns the tangent of the input value. The input is assumed to be an angle in radians.

Syntax: tan( <value> )

<value> is one of the following:

  • A numeric field. If there is a space in the field name, use square brackets.
  • A number.

Examples:

  • tan(distance)
  • tan(['Store dist'])
  • tan(1.2)

sqrt()

Returns the square root of the input value.

Syntax: sqrt( <value> )

<value> is one of the following:

  • A numeric field. If there is a space in the field name, use square brackets.
  • A number.

Examples:

  • sqrt(distance)
  • sqrt(['Store dist'])
  • sqrt(9)

min()

Returns the lowest valued number in the input field.

Syntax: min( <field name> )

  • field name—Can be any numeric field. If there is a space in the field name, place it in square brackets.

Examples:

  • min(distance)
  • min(['Store dist'])

max()

Returns the highest valued number in the input field.

Syntax: max( <field name> )

  • field name—Can be any numeric field. If there is a space in the field name, place it in square brackets.

Examples:

  • max(distance)
  • max(['Store dist'])

constrain(,,)

Returns the input value if it's within the constraining bounds. If the value is less than the low value, it returns the low value. If the value is greater than the high value, it returns the high value.

Syntax: constrain( <value> , <low> , <high> )

value, low, and high can be the following:

  • A numeric field. If there is a space in the field name, use square brackets.
  • A number.

Examples:

  • constrain( distance, 0, 10)—Returns 0 if distance is less than 0, 10 if distance is greater than 10, and distance otherwise.
  • constrain(['Store dist'], 6, distance)—Returns 6 if Store dist is less than 6, distance if Store dist is greater than distance, and Store dist otherwise.

iff(,,)

Returns one value if a condition evaluates to true, and another value if that condition evaluates to false.

Syntax: iff( <condition>, <true value> , < false value> )

condition is a conditional that is tested for each feature.

true value and false value can be the following:

  • A numeric field. If there is a space in the field name, use square brackets.
  • A number.
  • A function.

Examples:

  • iff(field1 > field2, field1, 0)—Returns field1 if field1 is greater than field2, and 0 otherwise.
  • iff(field1 > field2, iff(field2 = 0, field3, field4), 0)—Returns the result of the second iff function if field1 is greater than field2, and 0 otherwise.

when(,,,...,)

Evaluates a series of expressions in turn, until one evaluates to true.

Syntax: when( <expression1> , <result1> , <expression2> , <result2> , ... , <expressionN> , <resultN>, <default> )

  • expression—An expression. If there is a space in the field name, place it in square brackets.
  • result—Can be a number or field.
  • default—An optional value if none of the expression match.

Examples:

  • when((field1 + 10) > 1, 1,(field2 + 10) > 2 , 2, field3)—If field1 + 10 is greater than 1, returns 1. If not, checks if field2 + 10 is greater than 2. If yes, it returns 2. If not, it returns field3.

decode()

The decode function evaluates an expression and compares its value with subsequent parameters. If the expression matches, it returns the next parameter value. If none match, there is the option for the last parameter to be a default return value.

Syntax: decode( <conditional val> , <case1> , <result1>, <case2>, <result2>, ... <caseN>, <resultN>, <defaultValue> )

  • conditional val—Can be a field or an expression.
  • case—A value to be compared to the conditional val.
  • result—The result if the corresponding case matches the conditional val.
  • defaultValue—An optional value if no other values are true.

Examples:

  • decode(field1 + 3 , field1, 1, field2, 2, 0)—Compares equality between the conditional val field1 + 3 and case1 field1. If true, it returns 1. If false, it compares the equality between field1 + 3 and field2. If true, it returns 2; otherwise, it returns 0.

3/3/2017