【问题标题】:Generating points near the certain point (landmark) on a network在网络上的某个点(地标)附近生成点
【发布时间】:2021-06-16 14:05:49
【问题描述】:

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

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

【问题讨论】:

  • 您好!我们需要有关您尝试解决的问题的更多详细信息,以及您要响应的数据样本。例如,使用 dput(yourdataframe[1:10] ) 共享前十行,然后将输出粘贴到您的问题中。
  • 不需要示例数据。问题是关于spatstat 系列的 R 包(特别是关于处理网络的spatstat.linnet)。该问题要求函数runiflpp 的对应物在具有非均匀概率密度的网络上生成随机点。答案由下面的@rubak 给出。

标签: r spatstat


【解决方案1】:

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")

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-20
    • 1970-01-01
    • 2015-12-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多