[R-sig-Geo] gdistance: costDistance with barriers

karljarvis karljarvis at gmail.com
Thu Mar 12 19:35:52 CET 2015


Hi all,
I am seeing confusing behavior from the costDistance function in gdistance.
In general, when cost is constant, cost distance increases linearly with
actual distance. However, in this example, it is not doing that for the
longest few distances. Am I missing something?
Karl

r <- raster(nrows=18, ncols=36) 
r[] <- 1
t <- transition(r,function(x) 1/mean(x),4)
p <- cbind(seq(-120,120,by=40),rep(0,7))
costDistance(t,p)

> costDistance(t,p)
   1  2  3  4  5  6
2  4               
3  8  4            
4 12  8  4         
5 16 12  8  4      
6 16 16 12  8  4   
7 12 16 16 12  8  4



--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/gdistance-costDistance-with-barriers-tp7587891.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list