Helper function to ensure that polygons (e.g. parks, beaches, informal nature areas) are mutually-exclusive (i.e. non-overlapping).

polygons_mutually_exclude(input, mutually_exclude, snap_tolerance = 0)

Arguments

input

sf object to process (with projected coordinate reference system).

mutually_exclude

sf object. input polygons contained within this object, and intersections between the two, will be removed. Should have the same coordinate reference system as input.

snap_tolerance

numeric. Argument for tolerance level passed to sf::st_snap(), used to rectify nearly coincident edges between polygons before running sf::st_contains(). Provided either as a units object (see units::set_units()), or a number in the units of the coordinate reference system. Defaults to 0.

Value

The processed input polygons (sf object).

Details

Polygons vertices first are snapped at a tolerance level based on snap_tolerance (if specified) to rectify nearly coincident edges, before removing input polygons contained in mutually_exclude. Intersections between the two are then removed.