When intersections occur, what was originally 2 polygons features can become LINESTRING and/or POINT and any COLLECTIONS or MULTI- versions of these. This function evaluates what the original geometry was and drops any newly created different geometries. For example, if a POLYGON becomes a COLLECTION of MULTIPOLYGON, POLYGON and POINT geometries, the POINT geometries will be dropped. This function is used internally in postProcessTo().

keepOrigGeom(newObj, origObj)



The new, derived sf object


The previous, object whose geometries should be used.


The original newObj, but with only the type of geometry that entered into the function.