Useful in cases where two sets of polygons do not align perfectly spatially. Thus, intersecting produces slivers that are larger than can typically be easily dealt with (e.g., https://github.com/r-spatial/sf/issues/547).

intersect_clean(x, y, xcol, areaThresh = 0.05)

Arguments

x, y

sf polygons object

xcol

character, name of the attribute column in x to use to identify features

areaThresh

numeric, proportion of minimum polygon area to use as threshold crumb size.

Value

sf polygons object

Details

In these cases, deal with each of the set of features individually:

  1. Identify the feature sets of interest in x using the unique values of x[[xcol]] (i.e., sets of polygons that share an identifier);

  2. For each of the feature sets, calculate the area of the smallest feature in that set;

  3. For each of the feature sets, perform intersection with y and ensure validity;

  4. Post-intersection, remove any fragment polygons smaller than areaThresh * min(area).