I am trying to split a concave polygon into convex polygons using r. I am trying to figure out how to successfully accomplish this for one polygon with the hopes of implementing this on a large number of polygons in an automated way.
The only way I could think of so far was to use triangulation to break this shape into several smaller shapes, then group those into some minimized number convex polygons.
library(sp)
library(rgdal)
library(sf)
files <- list.files("~/Cluster polygons 2020",pattern=".shp", full.names=TRUE)
cluster=readOGR(files[1])
spatstat::is.convex(maptools::as.owin.SpatialPolygons(cluster[1,])) #CHECK IF CONVEX
[1] FALSE
plygn=sfdct::ct_triangulate(sf::st_as_sf(cluster[1,]),D=TRUE)
plygn=st_collection_extract(plygn, "POLYGON")
plygn=as_Spatial(plygn)
length(plygn) #HOW MANY TRIANGLES GENERATED?
[1] 58
This is as far as I have gotten. Is there a clever/principled way group the triangles into the smallest number of groups and then merge them so the final product is a set of convex polygons? Or is there an entirely better approach to this problem?
I appreciate the help. Here is a link to the shapefile