[R-sig-Geo] gdistance errors - passage and commuteDistance functions

Tamar Marcus marcus at leuphana.de
Fri Jun 6 10:33:17 CEST 2014


Hi All -

I am trying to create distance matrices between my 50 sampling points
using the various options available in gdistance, and am getting
strange error messages with the passage and commuteDistance functions.
I created a transition layer based on a conductance layer (also tried
with a resistance layer) created in arcGIS, with values of 0.0001
instead of 0 (so no isolated pixels) and then values ranging from
1-10. The conductance layer is pretty large - 2972 x 3925 pixels. The
costDistance function manages to run smoothly, but for the other 2
functions I get the errors listed below. I have tested the code with a
smaller layer and point set and it runs fine, but the issue is not RAM
(checked by running the code on a server and seeing RAM usage when it
threw the errors).

I would greatly appreciate any insight someone might have as to what
these errors mean and how I can possibly solve them. Google didn't
find much, but unfortunately that may be due to the Denglish, I
unfortunately need to run the code on a computer which has R installed
in German...

Many thanks!
Tamar

passage error - this one seems to be thrown not by R, but by something deeper:

cost.pass <- passage(tr_cond, orgin, destination, theta=0)


*** caught segfault ***

address 0x7fff5a83bf38, cause 'memory not mapped'



Traceback:

 1: .solve.dgC(a, as(b, "denseMatrix"), tol = tol, sparse = sparse)

 2: .local(a, b, ...)

 3: solve(a, Matrix(b))

 4: solve(a, Matrix(b))

 5: eval(expr, envir, enclos)

 6: eval(call, sys.frame(sys.parent()))

 7: callGeneric(a, Matrix(b))

 8: solve(t(IdMinusWj), ei)

 9: solve(t(IdMinusWj), ei)

10: .probPass(x, Id, W, nr, ci, cj, tc, totalNet, output)

11: .randomShPaths(x, ci, cj, theta, tc, totalNet, output)

12: .local(x, origin, goal, theta, ...)

13: passage(tr_cond, orgin, destination, theta = 0)

14: passage(tr_cond, orgin, destination, theta = 0)



Possible actions:

1: abort (with core dump, if enabled)

2: normal R exit

3: exit R without saving workspace

4: exit R saving workspace




commuteDistance error:

cost.commute<- commuteDistance(tr_cond, sites)

Fehler in LU.dgC(a) :

  cs_lu(A) fehlgeschlagen: near-Singuläres A (oder außerhalb des Speichers)



The code I am using:

final.cond <- raster("all_cond.txt")
tr_cond <- transition(final.cond, transitionFunction=mean, directions=4)

xyfilename <- "plot coords_sch.csv"
XY <- read.csv(xyfilename, header=TRUE)
xvals <- XY[,1]
yvals <- XY[,2]
xy <- cbind(xvals,yvals)
sites <- SpatialPointsDataFrame(coords=
as.data.frame(xy),as.data.
frame(xy))

orgin <- sites
destination <- sites

cost.pass <- passage(tr_cond, orgin, destination, theta=0)
cost.dist <- costDistance(tr_cond, sites)
cost.commute<- commuteDistance(tr_cond, sites)



More information about the R-sig-Geo mailing list