library(geojsonsf)
library(sf)
poly <- structure("{\"type\":\"FeatureCollection\",
\"features\":[{\"type\":\"Feature\",\"properties\":{},
\"geometry\":{\"type\":\"Polygon\",
\"coordinates\":[[[102,2],[102,4],[104,4],[104,2],[102,2]]]}},
{\"type\":\"Feature\",\"properties\":{},
\"geometry\":{\"type\":\"Polygon\",
\"coordinates\":[[[100,2],[98,4],[101.5,4],[100,2]]]}},
{\"type\":\"Feature\",\"properties\":{},
\"geometry\":{\"type\":\"Polygon\",
\"coordinates\":[[[100,0],[100,1],[101,1],[101,0],[100,0]]]}}]}",
class = c("geojson", "json"))
poly <- geojson_sf(poly)
plot(poly)
out <- ms_filter_islands(poly, min_area = 12391399903)
plot(out)
Run the code above in your browser using DataLab