Learn R Programming

leastcostpath (version 2.0.12)

calculate_distance: calculate distance between adjacent cells

Description

calculate distance between adjacent cells

Usage

calculate_distance(x, adj)

Value

matrix euclidean distances between adjacent cells

Arguments

x

spatRaster

adj

matrix of adjacent cells

Author

Joseph Lewis

Details

calculate_distance function allows for both projected and geographic coordinate systems. If the coordinate system is geographic (e.g. wgs84) the distance is calculated using the sf::st_distance function else distance calculated using Pythagorean theorem