mstrimas / smoothr

Spatial Feature Smoothing in R
http://strimas.com/smoothr
GNU General Public License v3.0
96 stars 5 forks source link

threshold=0 in fill_holes #4

Closed jldupouey closed 4 years ago

jldupouey commented 4 years ago

When threshold=0, an error is generated by the fill_holes function. It should be nice, either:

  1. to indicate in the manual that threshold must be strictly positive (one word to add in the description of the threshold parameter),

  2. or to change the behaviour of the function, returning the same output as the original, input layer in case threshold is 0. The test is already done in the function (stopifnot(threshold > units::set_units(0, area_units, mode = "standard"))), it is just a minor change,

and, optionnaly, to emit a meaningful error message.

Thanks,

Jean-Luc

mstrimas commented 4 years ago

Thanks for the suggestion! I've allowed threshold to be zero in which case the function returns the input object unchanged. There's also a more informative error if threshold < 0.