I am trying to run Fusion's GridMetrics
from R, I wrote this for one las file:
#First set up directories to keep the raw data
#separate from that produced by the analysis, Input (.las) and (.dtm),
#and output (.csv) directory in a dropbox folder.
mainDir <- "F:/Dropbox/LiDAR_Prj"
inDir <- "inputDirectory"
outDir<- "outputDirectory"
dir.create(file.path(mainDir, outDir), showWarnings = FALSE)
#Run grid metrics in FUSION
#Read in the .las files and use FUSION to produce the .csv files with values for 14 m pixel.
system(paste(file.path("C:","Fusion", "gridmetrics.exe"),
"/outlier:-5,250 /minht:1.64 /strata:8.2,16.40",
file.path(mainDir, inDir, "*.dtm"), 13.1,45.93,
file.path(mainDir, outDir, "2H8546.csv"),
file.path(mainDir, inDir, "2H8546.las"),
sep=" "))
It worked very well. However, I would like to automate it because I have more than 400 tiles to process (file names are not a sequence).
I attempted to use a txt file listing the data files instead of the file names:
mainDir <- "F:/Dropbox/LiDAR_Prj"
inDir <- "inputDirectory"
outDir<- "outputDirectory"
dir.create(file.path(mainDir, outDir), showWarnings = FALSE)
#Run grid metrics in FUSION
#Read in the .las files and use FUSION to produce the .csv files with values for 14 m pixel.
system(paste(file.path("C:","Fusion", "gridmetrics.exe"),
"/outlier:-5,250 /minht:1.64 /strata:8.2,16.40",
file.path(mainDir, inDir, "*.dtm"), 13.1,45.93,
file.path(mainDir, outDir, "halistcsv.txt"),
file.path(mainDir, inDir, "halist.txt"),
sep=" "))
but a warning message pops up:
Too many points (couldn't allocate memory for point list)...no metrics computed
Run finished: Tue Nov 22 19:39:35 2016 (elapsed time: 21 seconds)
***There were errors during the run
Done
Warning message:
running command 'C:/Fusion/gridmetrics.exe ... halist.txt' had status 5
Could any of you help me to figure out an efficient way to automate this process?
memory.limit()
? Have you looked into increasing the memory limit? stackoverflow.com/q/1395229/1446289