获取R上两条线(电缆和迁移路线)的交点数

问题描述 投票:0回答:0

对于我的项目,我用这段代码模拟了迁移路径

fooR <- replicate(5,crw_in_polygon(sea, theta = c(0,2), stepLen = 500, initPos = c(-2.65,56.11), initHeading=350, nsteps=800,sp_out = TRUE))

map 海洋是地图上路径所在的区域。在这张地图上,我也有电缆线,我想看看路径穿过多少根电缆。

我尝试了很多不同的东西,但它从来没有奏效

gIntersects(fooR,电缆), dplyr::intersect(fooR, cables) , st_intersection(fooR,电缆), dplyr::相交(fooR,电缆).

我得到这些错误:

as.vector(x) 中的错误:没有将此 S4 类强制转换为向量的方法。 >UseMethod("st_intersection") 错误: 没有适用于“st_intersection”的适用方法应用于“列表”类的对象 RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) 错误: 试图从没有插槽的基本类(“列表”)的对象中获取插槽“proj4string”

我不知道使用什么代码来获取一般或每条路径的交叉点数量。

--> 所以我需要帮助才能知道模拟路径交叉的电缆数量是如何或用什么代码提供的。

提前感谢您的帮助。

加:地图上的文件是用readOGR打开的

r model line intersection
© www.soinside.com 2019 - 2024. All rights reserved.