在R中使用rsagacmd包进行镶嵌

时间:2020-10-12 10:10:45

标签: r gis

我目前正在尝试使用镶嵌工具(R包:rsagacmd)合并多个栅格。不幸的是,它不能与测试数据一起使用(下面的可复制示例;就我所知,必须安装SAGA-GIS)。

我收到此错误:

Error:    
 loading spatial reference system database:    
101%    
 87%    
In addition: Warning message:    
In system(saga_cmd, intern = TRUE) :    
 Show Traceback    
 Rerun with Debug    
 Error:     
 loading spatial reference system database:    
101%    
 87% 

所有其他SAGA工具都可以毫无问题地执行。只有将栅格列表作为输入,才有问题。

编辑:在传奇中,可以轻松地通过镶嵌合并网格。

有人暗示吗?

install.packages("raster")
install.packages("Rsagacmd")
library(raster)
library(Rsagacmd)

saga_tools <- saga_gis(opt_lib = c("grid_calculus", "grid_tools"))
# example of executing a tool using a tempfile to store the tool outputs

r1 <- saga_tools$grid_calculus$random_terrain(radius = 100, iterations = 100)
r2 <- saga_tools$grid_calculus$random_terrain(radius = 100, 
                                              iterations = 100, 
                                              target_user_xmin = 100,                                                                                                                                           
                                              target_user_xmax = 200, 
                                              target_user_ymin = 0, 
                                              target_user_ymax = 100)

r.list <- as.list(r1, r2)
r.m <-  saga_tools$grid_tools$mosaicking(r.list)
# more parameters:
r.m <-  saga_tools$grid_tools$mosaicking(r.list, 
                                         resampling = 1, 
                                         overlap = 1, 
                                         match = 0, 
                                         target_user_size = 1, 
                                         target_definition = 0, 
                                         target_user_xmax = 200,
                                         target_user_xmin = 0,
                                         target_user_ymin = 0,
                                         target_user_ymax = 100,
                                         target_user_fits = 0)

0 个答案:

没有答案