After dissolving inner boundaries, this sf shape [Pastebin] retains residual specks or crumbs:
library(sf)
#download file "shp.txt" from Pastebin
shp <- dget("shp.txt")
class(shp)
[1] "sfc_MULTIPOLYGON" "sfc"
plot(shp)
I have tried 2 different methods of removing them but both fall short:
#CRS is in meters so that threshold parameters are expressed in square meters in both methods
st_crs(shp)$units
[1] "m"
#Method #1
library(rmapshaper)
shp <- ms_filter_islands(shp, min_area=1000000)
plot(shp)
Method #1 fails to remove at least one tiny speck in the centre of the shape:
#Method #2
library(smoothr)
shp <- drop_crumbs(shp, threshold=1000000)
plot(shp)
Method #2 doesn't do anything, apparently.
What are substitute or complementary ways of accomplishing the task?
sf
object.rmapshaper
, which my question includes.