检查st_intesection是否为true/falseSF包

Check if st_intesection is true/false Sf package

如何使用 R 中的 sf 包检查点是否与具有布尔结果的多边形相交

library(sf)
dub<- st_as_sf(data.frame(lon=72.917,lat=19.112), coords=c("lon","lat"),crs=4326)
a<- st_as_sf(data.frame(lon=72.930,lat=19.112), coords=c("lon","lat"), crs=4326)
buf<- st_buffer(a,0.01)

我尝试了交叉长度,但它不起作用

length(st_intersection(dub,buf))

使用 st_intersects 而不是 st_intersection 并设置稀疏 = FALSE

> st_intersects(dub, buf, sparse = FALSE) 
# although coordinates are longitude/latitude, st_intersects assumes 
# that they are planar
#       [,1]
# [1,] FALSE