Function to calculate distance and direction of change between centroids
Source:R/dist_centroids.R
dd.calc.Rd
Function to calculate distance and direction of change between centroids
Examples
# \donttest{
library(terra)
r1 <- terra::rast(system.file("extdata", "ref.tif",
package = "divraster"))
r2 <- terra::rast(system.file("extdata", "fut.tif",
package = "divraster"))
dd.calc(r1, r2)
#> Layer Distance_meters Direction
#> 1 A 6844.296 Southeast
#> 2 B 2646.550 Northwest
#> 3 C 13967.055 Northwest
#> 4 D 9453.585 Northwest
#> 5 E 5488.573 Northwest
#> 6 F 3300.834 Northwest
#> 7 G 3895.065 Southwest
#> 8 H 3460.013 Northeast
#> 9 I 7479.346 Northwest
#> 10 J 2390.447 Southwest
# }