Geographic Information Systems Asked by Kryštof Chytrý on November 2, 2020
I want to use RSAGA package in R to calculate the topographical wetness index. However, while applying the rsaga.wetness.index()
function, R gives me an error message (see below).
My question is, where should I look for the problem. In the DEM, perhaps in the installation files of the package?
The input raster is originally saved as .grd
file, it is of LAEA Europe projection and it has 100 per 100 m resolution.
projection(dem)
> "+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"
res(dem)
> [1] 100 100
SagaEnv = rsaga.env(modules = 'C:SAGA-GIS')
rsaga.wetness.index(in.dem = dem, sagaEnv = SagaEnv)
> Error in nchar(filename) :
> no method for coercing this S4 class to a vector
Save your DEM to a .sgrd file using writeRaster
:
> writeRaster(rdem,"rdem.sgrd", overwrite=TRUE)
and then it gets past that error. Of course I have other errors but I'm not using this at the moment. This might work for you. If you get these errors then its a RSAGA version mismatch (I need to upgrade things) and ask a new Q if you can't fix it:
> rwi = rsaga.wetness.index("rdem.sgrd","rwi.sgrd")
Error: select a tool
Error in if (any(modules[, wh] == module)) return(TRUE) :
missing value where TRUE/FALSE needed
In addition: There were 23 warnings (use warnings() to see them)
Answered by Spacedman on November 2, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP