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 (<a href="https://johnbaumgartner.wordpress.com/2012/07/26/getting-rasters-into-shape-from-r/" rel="nofollow noreferrer">https://johnbaumgartner.wordpress.com/2012/07/26/getting-rasters-into-shape-from-r/</a>). 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
, followed by
. I am currently exploring this with particular attention to ensuring polygon features with holes remain associated with the parent polygon (see: <a href="https://stackoverflow.com/questions/19315832/split-polygon-parts-of-a-single-spatialpolygons-object">Split polygon parts of a single SpatialPolygons Object</a>). Will update again if/when I find a solution.
I created a polygon layer from a raster file using gdal_polygonizeR (<a href="https://johnbaumgartner.wordpress.com/2012/07/26/getting-rasters-into-shape-from-r/" rel="nofollow noreferrer">https://johnbaumgartner.wordpress.com/2012/07/26/getting-rasters-into-shape-from-r/</a>). 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
Code:
aggregate
Code:
disaggregate