Removes polygon holes from an sf, sfc, or sfg object. With a positive
max_area, only holes smaller than the threshold are removed.
remove_geom_holes(x, max_area = 0)An object of the same class as x, with selected holes removed.
For a faster alternative when max_area is unnecessary, see
sfheaders::sf_remove_holes():
https://github.com/dcooley/sfheaders.
This implementation is adapted from
nngeo::st_remove_holes(),
written by Michael Dorman and distributed under the MIT License.
Adapted from the StackOverflow answer by user lbusett:
https://stackoverflow.com/questions/52654701/removing-holes-from-polygons-in-r-sf.