I have a dataset with overlapping polygons. I would like the clip the overlapping polygons (which I need to retain as overlapping) to a boundary (another polygon). I am using
st_intersection but due to the size of my data (60,000 polygons) this is not a quick process (I stopped it after an hour). For comparison I've tried using QGIS (I also stopped that after an hour with it still processing) and ArcMap (completed the task in 3 minutes). Is there a way I can complete the task using R in a reasonable time frame?
The code below recreates my data (I am after
Points_Buffer being clipped to
library(sf) download.file("https://borders.ukdataservice.ac.uk/ukborders/easy_download/prebuilt/shape/England_gor_2011_clipped.zip", destfile = "England_gor_2011_clipped.zip" , mode='wb') unzip("England_gor_2011_clipped.zip", exdir = ".") file.remove("England_gor_2011_clipped.zip") Boundary <- st_read("England_gor_2011_clipped.shp") %>% st_transform(., crs=27700) Boundary_Crop <- st_crop(Boundary,st_bbox(c(xmin = 401000, xmax = 500000, ymax = 172000, ymin = 74000), crs = st_crs(27700))) Points_Buffer <- st_sample(Boundary_Crop, 60000, exact = TRUE) %>% st_buffer(., 2000) Points_Buffer_Clip <- st_intersection(Points_Buffer, Boundary)