Skip to content

Commit

Permalink
change to as("Raster") it is faster
Browse files Browse the repository at this point in the history
  • Loading branch information
see24 committed Mar 13, 2024
1 parent 34355a0 commit ecd0e46
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion R/getGraph.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ getGraph<- function(sim, neighbourhood,method="gdistance"){
rook=4,
octagon=8,
queen=8)
x = gdistance::transition(raster::raster(sim$costSurface), transitionFunction=function(x) 1/mean(x), directions=dirs)
x = gdistance::transition(as(sim$costSurface, "Raster"), transitionFunction=function(x) 1/mean(x), directions=dirs)

if(neighbourhood=="octagon"){
#correct for diagonal distances and other aspects of geographic distance
Expand Down

0 comments on commit ecd0e46

Please sign in to comment.