在网络上的特定点(地标)附近生成点

Generating points near the certain point (landmark) on a network

假设我们有一个网络和网络上的一个固定点(如停车标志或交通灯等地标)。

我可以使用 runiflpp(n, a linnet object) 在网络上生成均匀分布的点,但是有没有办法只在这个地标周围生成点,但仍然在网络上?有没有办法指定该点周围 5 或 10 米的距离?

runiflpp() 的帮助文件指向 rlpp() 非均匀随机 点,并且 rlpp() 允许您在线性上使用函数或图像 网络来指定点的强度。所以一种策略是指定一个 正常数的函数或图像关闭兴趣点 (POI)和其他地方为零:

library(spatstat.linnet)
L <- simplenet
P <- lpp(c(.5,.5), L) # POI
plot(P, main = "Point of interest (POI)")

Dfun <- distfun(P) # Distance function to POI
plot(Dfun, main = "Distance to POI")

f <- function(x, y, seg, tp){ #' Function which is 1 "close" to POI and else 0
  ifelse(Dfun(x = x, y = y, seg = seg, tp = tp) < 0.3, 1, 0)
}
closefun <- linfun(f, L) # As function on the network
plot(closefun, main = "Indicator of closeness to POI")
plot(P, add = TRUE, cex = 2, pch = 20)

X <- rlpp(n = 10, f = closefun)
plot(X, main = "Random points close to POI")