R 检查st_intesection是否为真/假Sf包
如何使用R中的sf包检查点是否与具有布尔结果的多边形相交R 检查st_intesection是否为真/假Sf包,r,sf,R,Sf,如何使用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) 使用st_相交notst
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)
使用
st_相交
notst_相交
并设置sparse=FALSE
> st_intersects(dub, buf, sparse = FALSE)
# although coordinates are longitude/latitude, st_intersects assumes
# that they are planar
# [,1]
# [1,] FALSE
@sebdalgarno我对两个点(多边形内部和外部)
PointIN 1都错了
我的道歉-见修改后的回答我也遇到了多余的论点。无论如何,感谢您指出st_intersect:)
> st_intersects(dub, buf, sparse = FALSE)
# although coordinates are longitude/latitude, st_intersects assumes
# that they are planar
# [,1]
# [1,] FALSE