I was wondering why sf::st_intersection() takes too much time, in comparison with sp::over(); I use sf for pretty much all of my geospatial workflows (I was used to sp as well), and more and more packages are building support for sf objects; is there a way for speeding up st_intersection? According to st_intersection man page: "A spatial index is built on argument x", so I can't build a spatial index to speed it up.
In the following example eke is a point (sp or sf) object and ver_poly is a polygon object, even coerced to "Spatial", sp::over() goes faster (just using 10000 points, whole object is 150000 features):
> system.time(en_ver <- over(eke[1:10000,], as(ver_poly, "Spatial")))
user system elapsed
0.573 0.004 0.576
> system.time(eke[1:10000,] %>% st_as_sf(coords = c("longitud", "latitud")) %>% st_set_crs(4326) %>%
+ st_intersection(ver_poly))
although coordinates are longitude/latitude, st_intersection assumes that they are planar
user system elapsed
83.552 0.004 83.585