I've been looking for an existing R function(s) for aggregating polygon features within the same layer that share a common boundary (i.e., producing output like 'Dissolve Boundaries' tool in ArcGIS).
I created a polygon layer from a raster file using gdal_polygonizeR (https://johnbaumgartner.wordpress.com/2012/07/26/getting-rasters-into-shape-from-r/). Some of the polygon shapes are separated by a single raster cell, and are therefore stored as distinct features in the shapefile. I want to combine such polygon features into a single polygon feature, and create a new shapefile (reducing the total number of polygon elements), ideally with a threshold distance for dissolving.
Does anyone know of an existing method for doing this in R?
UPDATE:
I think the solution may involve aggregate
, followed by disaggregate
. I am currently exploring this with particular attention to ensuring polygon features with holes remain associated with the parent polygon (see: Split polygon parts of a single SpatialPolygons Object). Will update again if/when I find a solution.