This tool extracts features from an input vector into an output file based on attribute properties. The user must specify the name of the input (--input) and output (--output) files, along with the filter statement (--statement). The conditional statement is a single-line logical condition containing one or more attribute variables contained in the file's attribute table that evaluates to TRUE/FALSE. In addition to the common comparison and logical
operators, i.e. < > <= >= == (EQUAL TO) != (NOT EQUAL TO) || (OR) && (AND), conditional statements may contain a
any valid mathematical operation and the null value.

IdentifierArgument AmountArgument TypesDescription
`min`>= 1NumericReturns the minimum of the arguments
`max`>= 1NumericReturns the maximum of the arguments
`len`1String/TupleReturns the character length of a string, or the amount of elements in a tuple (not recursively)
`floor`1NumericReturns the largest integer less than or equal to a number
`round`1NumericReturns the nearest integer to a number. Rounds half-way cases away from 0.0
`ceil`1NumericReturns the smallest integer greater than or equal to a number
`if`3Boolean, Any, AnyIf the first argument is true, returns the second argument, otherwise, returns the third
`contains`2Tuple, any non-tupleReturns true if second argument exists in first tuple argument.
`contains_any`2Tuple, Tuple of any non-tupleReturns true if one of the values in the second tuple argument exists in first tuple argument.
`typeof`1Anyreturns "string", "float", "int", "boolean", "tuple", or "empty" depending on the type of the argument
`math::is_nan`1NumericReturns true if the argument is the floating-point value NaN, false if it is another floating-point value, and throws an error if it is not a number
`math::is_finite`1NumericReturns true if the argument is a finite floating-point number, false otherwise
`math::is_infinite`1NumericReturns true if the argument is an infinite floating-point number, false otherwise
`math::is_normal`1NumericReturns true if the argument is a floating-point number that is neither zero, infinite, [subnormal](https://en.wikipedia.org/wiki/Subnormal_number), or NaN, false otherwise
`math::ln`1NumericReturns the natural logarithm of the number
`math::log`2Numeric, NumericReturns the logarithm of the number with respect to an arbitrary base
`math::log2`1NumericReturns the base 2 logarithm of the number
`math::log10`1NumericReturns the base 10 logarithm of the number
`math::exp`1NumericReturns `e^(number)`, (the exponential function)
`math::exp2`1NumericReturns `2^(number)`
`math::pow`2Numeric, NumericRaises a number to the power of the other number
`math::cos`1NumericComputes the cosine of a number (in radians)
`math::acos`1NumericComputes the arccosine of a number. The return value is in radians in the range [0, pi] or NaN if the number is outside the range [-1, 1]
`math::cosh`1NumericHyperbolic cosine function
`math::acosh`1NumericInverse hyperbolic cosine function
`math::sin`1NumericComputes the sine of a number (in radians)
`math::asin`1NumericComputes the arcsine of a number. The return value is in radians in the range [-pi/2, pi/2] or NaN if the number is outside the range [-1, 1]
`math::sinh`1NumericHyperbolic sine function
`math::asinh`1NumericInverse hyperbolic sine function
`math::tan`1NumericComputes the tangent of a number (in radians)
`math::atan`1NumericComputes the arctangent of a number. The return value is in radians in the range [-pi/2, pi/2]
`math::atan2`2Numeric, NumericComputes the four quadrant arctangent in radians
`math::tanh`1NumericHyperbolic tangent function
`math::atanh`1NumericInverse hyperbolic tangent function.
`math::sqrt`1NumericReturns the square root of a number. Returns NaN for a negative number
`math::cbrt`1NumericReturns the cube root of a number
`math::hypot`2NumericCalculates the length of the hypotenuse of a right-angle triangle given legs of length given by the two arguments
`math::abs`1NumericReturns the absolute value of a number, returning an integer if the argument was an integer, and a float otherwise
`str::regex_matches`2String, StringReturns true if the first argument matches the regex in the second argument (Requires `regex_support` feature flag)
`str::regex_replace`3String, String, StringReturns the first argument with all matches of the regex in the second argument replaced by the third argument (Requires `regex_support` feature flag)
`str::to_lowercase`1StringReturns the lower-case version of the string
`str::to_uppercase`1StringReturns the upper-case version of the string
`str::trim`1StringStrips whitespace from the start and the end of the string
`str::from`>= 0AnyReturns passed value as string
`bitand`2IntComputes the bitwise and of the given integers
`bitor`2IntComputes the bitwise or of the given integers
`bitxor`2IntComputes the bitwise xor of the given integers
`bitnot`1IntComputes the bitwise not of the given integer
`shl`2IntComputes the given integer bitwise shifted left by the other given integer
`shr`2IntComputes the given integer bitwise shifted right by the other given integer
`random`0EmptyReturn a random float between 0 and 1. Requires the `rand` feature flag.
`pi`0EmptyReturn the value of the PI constant./

The following are examples of valid conditional statements:

HEIGHT >= 300.0

CROP == "corn"

(ELEV >= 525.0) && (HGT_AB_GR <= 5.0)

math::ln(CARBON) > 1.0

VALUE == null

Function Signature

def extract_by_attribute(self, input: Vector, statement: str) -> Vector: ...

Project Links

WbW Homepage User Manual Support WbW