I have two large gpkg datasets. I would like to clip one from the other and use parallel processing to speed up the process. However, I receive an error message. Code and error message shown below:
#load required libraries library(sf) library(future.apply) #Set up parallel processing options(future.numCores = 20) plan(multicore) #Load the source geopackage gpkg_source <- st_read("E:/Roads/UK_roadlink_NoPaths.gpkg") #Load the clip geopackage gpkg_clip <- st_read("E:/Areas/400m_GB_Dissolved.gpkg") #Clip the data gpkg_clipped <- future_sapply(gpkg_source, function(x) { st_intersection(x, gpkg_clip) }) #Combine the clipped data into a single sf object gpkg_clipped <- do.call(rbind, gpkg_clipped) #Save the clipped geopackage to a new file st_write(gpkg_clipped, "E:/Roads/NoPaths_400mCatchment_Clip.gpkg") #Stop parallel processing plan(sequential) Error message
Error in UseMethod("st_intersection") : no applicable method for 'st_intersection' applied to an object of class "character" I have tried to see whether the gpkg is in fact returned as character using
class("E:/Roads/UK_roadlink_NoPaths.gpkg") Which returns the following:
[1] "character" Both gpkg's load fine in QGIS and ArcGIS Pro and I am able to conduct analyses on them.
Where am I going wrong in my code?