[R-sig-Geo] gdistance, least cost path in R

Jan Hendrik Blanke jan.blanke at gmx.de
Thu Nov 10 16:37:38 CET 2011


Hello together,

I would like to conduct a least cost path analysis in R that would deliver the same results than GRASS GIS (r.cost followed by r.drain) or ArcGIS (Cost Distance followed by Cost Path, both Spatial Analyst). For that purpose, I created a raster with  cost values ranging from 1 to 8; the starting and stop points are from the class SpatialPointsDataFrame.

I used the package gdistance now to calculate the path with the least costs from source to destination but could not manage to get the same results than GRASS GIS and ArcGIS. Gdistance uses a transition layer instead of an accumulative cost grid. For the latter one an iterative process is used that begins with the source cells. The transition layer instead is calculated by a transition function that calculates transition values from grid values (e.g. mean).

I guess the problem lies in the creation of the transition layer with transitionFunction. I am not sure which function I would need to use. In addition, I am wondering how the transition layer could be similar to the accumulative cost grid as the transition layer does not calculate the values starting from a source cell.

I would really appreciate if you could give me any hints on how to achieve the same results in R. Thank you very much for your efforts.

Kind regards,

Jan 
--



More information about the R-sig-Geo mailing list