jeudi 15 janvier 2015

Using the accCost() function in R: questions regarding the transition layer


I am trying to use the accCost() function from the gdistance package in R. I load my cost raster using the raster()function from the raster package.


According to the documentation, I need first to convert my raster object to a transitionLayer object:


tr_cost <- transition(cost,transitionFunction=mean,8)


My results seem to be very sensitive to the way I create tr_cost with this function. According to the parameters I put, I can end up with many cells with a value of 0 where I know it should be something else (my raster is the land of a country, surrounded by NA's). But I must admit I do not quite understand how the two parameters transitionFunction and directionswork.


For transitionFunction, the reference manual does not provide an exhaustive list of the built-in functions and how they work (this page explains a little, but it's still not clear for me). Regarding directions, I found that changing from 16 to 8 increases the number of cells with no data.


I thus have the following questions:



  1. What does the transitionFunctioncorrespond to?

  2. Is there a transition function that is best suited to deal with accumulated cost?

  3. What are the pro's and con's of using 16 directions instead of 8?


Thank you for your help!





Aucun commentaire:

Enregistrer un commentaire