Description Usage Arguments Value Examples
View source: R/Calculate_distances_functions.R
Calculate 2D distances from points to points avoiding obstacles
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
from |
Point data set from which to calculate distances. May be a 2-col matrix of (x,y) coordinates or a SpatialPointDataFrame. Should be in same projection than r.ref. This can also be an object of class distref.data. |
to |
Point data set from which to calculate distances. May be a 2-col matrix of (x,y) coordinates or a SpatialPointDataFrame. Should be in same projection than r.ref. If not set to = from. This can also be an object of class distref.data. If "to" is provided, it should be the bigger dataset. |
r.ref |
reference raster used for distance without obstacles calculation |
dref.r |
object of class distref.raster. Reference raster already processed using distref.raster (e.g. usefull if previously saved using filename.) |
n.cores |
number of cores to run parallel calculation. Default to all cores using parallel::detectCores() |
closest |
if a point is over an obstacle, set to TRUE to find the closest non-obstacle r.ref cell |
step.ang |
Step for angles classes breaks (in degrees). This means that a distance error is allowed in future calculations. Distance error (%) = 100 * (1 - cos((step.ang/2)*pi/180)). With step.ang = 5 degrees, error < 0.1%. Default set to 5. |
r.ref3D |
Logical. Wether the reference raster should be used as a 3D surface to calculate distance accounting for elevation. |
filename |
Path where to save the dref.r issued from reference raster. This may be usefull for re-using the raster for different datasets. Default to paste0(tempdir(),"/dref.r.RData") |
small.dist |
if TRUE, distances <= 1 paths are directly calculated. |
keep.path |
Logical. Whether to keep SpatialLines of paths. This allows real distances when 2 points are in the same raster cell or close. |
longlat |
Logical. if FALSE, Euclidean distance, if TRUE Great Circle distance. Defined from r.ref. |
tol |
numeric Tolerance to define distances between points to be null. |
igraph |
Logical. Wether to calculate all distances through igraph (TRUE)
or use |
If keep.path is false, returns a matrix of distances with rows = "from" and cols = "to". If keep.path is true, returns a list where dist.mat is the matrix of distance and listLines is a list of SpatialLines. Each list is a SpatialLinesDataFrame corresponding to a starting point in "from".
1 2 3 4 5 6 7 8 9 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.