r-spatial / sf

Simple Features for R
https://r-spatial.github.io/sf/
Other
1.35k stars 299 forks source link

When I encountered an error using the st_join function——Error in checkForRemoteErrors(val) : 4 nodes produced errors; first error: Loop 0 is not valid: Edge 9 is degenerate (duplicate vertex) #2364

Closed liufan612 closed 7 months ago

liufan612 commented 8 months ago

shape <- st_make_valid(shape) glo_shape1 <- st_make_valid(glo_shape)
library(parallel) sf::sf_use_s2(FALSE) num_cores <- 8

cl <- makeCluster(num_cores) clusterEvalQ(cl, { library(sf) })

clusterExport(cl, c("shape", "glo_shape1")) chunks <- split(1:nrow(shape), 1:num_cores)

result_list <- parLapply(cl, chunks, function(indices) { st_join(shape[indices, ], glo_shape1[, c("NAME_ZH", "geometry")], largest =TRUE) }) Error in checkForRemoteErrors(val) : 4 nodes produced errors; first error: Loop 0 is not valid: Edge 9 is degenerate (duplicate vertex) Is it related to parallelism

edzer commented 8 months ago

Is it related to parallelism

Does it go away without it?