if (FALSE) {
library("RSAGA")
data(landslides)
# Print the DEM header:
dem$header
# Write the DEM to a SAGA grid:
write.sgrd(data = dem, file = "dem", header = dem$header, env = env)
# Calculate slope of DEM:
rsaga.slope(in.dem = "dem", out.slope = "slope", method = "poly2zevenbergen")
# Pick slope values at landslide points,
# added to landslides data.frame as variable "slope":
landslides <- pick.from.saga.grid(data = landslides,
filename = "slope",
varname = "slope")
}
Run the code above in your browser using DataLab