[R-sig-Geo] loop memory problem

marta azores martazores at gmail.com
Wed Mar 15 18:37:46 CET 2017


Hi again,

I read in the guide of foreach that include the packages was a good idea.
Now the parallel loop is runing but at the end I got only one spatial line
(the first) I don't understand why is not adding the other spatiallines.

Any idea?

###3)dopar%
library(doSNOW)
registerDoSEQ()
registerDoParallel(cores=10)
getDoParWorkers()
line2<- gdistance::shortestPath(trCostS16, pos at coords[13,],pos at coords[12,],
output="SpatialLines")#

x<-foreach(i=2:13,.packages=c("gdistance","doParallel","foreach","base","sp"))
%dopar% {
  nextSegment2=gdistance::shortestPath(trCostS16,
pos at coords[i,],pos at coords[i+1,],
output="SpatialLines")
  line2 =nextSegment2+line2
  print(i)}

stopCluster(cl)
registerDoSEQ()

Thanks in advance,
Marta
####files
https://drive.google.com/open?id=0BwqSBe1Yq-FBUWVBOUdvaThEU1k

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list