The function calculates the distance to cells on a raster when the path has to go through the centers of neighboring cells. Distances are computed by summing local distances between cells, which are connected with their neighbours in 8 directions ('queen' case).
In future versions, the distance is expressed in meters if the coordinate reference system (CRS) is longitude/latitude (+proj=longlat
) and in the units of the CRS (typically meters) in other cases.