Merge sf
data table, such as StratumPolygon
Value
sf
with polygons merged
Details
All columns must have the same value for all polygons that are to be merged. If columns are not consistent in this regard, an error is raised.
In order to deal with any inaccuracies in polygon definitions, polygons are snapped to a common grid before merging
This has to be done in planar coordinates, the projection used is controlled by 'snapProjection'
The resolution of the grid is controlled by the parameter 'tolerance', which can be either a units object,
or a numerical value passed to st_snap
.
The interpretation of tolerance as a numerical value is defined in sf, but visual inspection of results is always adviced.
Examples
#merge ICES area-definitions by division
library(sf)
division <- RstoxFDA::ICESareas
division$StratumName <- paste(division$Major_FA,
division$SubArea, division$Division, sep=".")
merged <- mergePolygons(division["StratumName"], "StratumName", tolerance=.001)
#compare original area definition with merged
RstoxFDA::plotAreaComparison(RstoxFDA::ICESareas, merged, ylim=c(30,80), areaLabels2 = TRUE)