replaceWithOtherFieldIf method

DiscreteFieldFunction replaceWithOtherFieldIf({
  1. required BooleanFieldFunction selection,
  2. required DiscreteFieldFunction otherField,
})

Composes a function that preserves values from this function's field result or replaces them with values from another.

Values are determined, point-wise, across the spatial intersection of the selection with the union of the two function's field results. Where the selection is true, values from the other field are returned. Where false, values from this function's field result are returned. The function result has no data where the selection or the selected field has no data.

The function result extent is the intersection of the selection with the union of this function's field result and the other.

The spatial reference of this function's field result, the other, and the selection must be equivalent.

Parameters:

  • selection — A selection.
  • otherField — The discrete field function to draw values from when replacing.

Return Value: A function that preserves values from this function's field result or replaces them with values from another.