if (FALSE) {
## load and aggregate example DEM
data("volcano")
dem <- raster::raster(volcano)
dem <- raster::aggregate(x = dem, 2) * 10
dem@extent <- dem@extent * 1000
dem@extent <- dem@extent + c(510, 510, 510, 510)
## define example stations
stations <- cbind(c(200, 700), c(220, 700))
## plot example data
raster::plot(dem)
points(stations[,1], stations[,2])
## calculate distance matrices and stations distances
D <- spatial_distance(stations = stations,
dem = dem,
topography = TRUE,
cores = 1)
## plot distance map for station 2
raster::plot(D$maps[[2]])
## show station distance matrix
print(D$stations)
## run with small aoi
D <- spatial_distance(stations = stations,
dem = dem,
topography = TRUE,
cores = 1,
aoi = c(400, 600, 600, 800))
}
Run the code above in your browser using DataLab