【问题标题】:Least cost path barrier (R) (gdistance)最低成本路径障碍 (R) (gdistance)
【发布时间】:2017-06-17 11:01:47
【问题描述】:

我正在尝试创建一个成本最低的路径无法跨越的障碍(河流)。

我使用“区域”创建了一个过渡层,其中包含陆地和河流的过渡值。但是,屏障周围有一个“缓冲区”,其值不断增加,而不是一个离散的屏障。

成本栅格和过渡层 可以看出,在过渡层的屏障周围有一个“缓冲区”。

关于如何创建离散边界的任何想法?最好将障碍设为 1000,其他地方设为 1。

谢谢!

代码: library(gdistance) ## Create cost surface where "land" exists in the middle cost <- raster(nrow=100, ncol=100, xmn=0, xmx=100, ymn=0, ymx=100, crs="+proj=utm") cost[] <- 10 cost[cellFromRowColCombine(cost, 50:55,20:80)] <- 1000 costf <- asFactor(cost < 100) ## Produce transition matrices, and correct because 8 directions trCost <- transition(costf, "areas", directions=16) trCost1 <- geoCorrection(trCost[[2]], type="c") plot(cost) plot(raster(trCost[[1]]))

【问题讨论】:

标签: r gis r-raster


【解决方案1】:

我建议您将真正的障碍定义为NA 值,而不是高值,因为概率总是可能的:

library(gdistance)

## Create cost surface where "land" exists in the middle
cost <- raster(nrow=100, ncol=100, 
               xmn=0, xmx=100, ymn=0, ymx=100, crs="+proj=utm")
cost[] <- 10
cost[cellFromRowColCombine(cost, 50:55,20:80)] <- NA
costf <- asFactor(cost < 100)
## Produce transition matrices, and correct because 8 directions
trCost <- transition(costf, "areas", directions=16)
plot(cost)
plot(raster(trCost))

【讨论】:

    猜你喜欢
    • 2015-05-28
    • 2014-03-03
    • 1970-01-01
    • 2011-07-15
    • 1970-01-01
    • 1970-01-01
    • 2018-03-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多