BKS
BKS

Reputation: 151

how to deal with large linnet object

I am trying to use a whole city network for a particular analysis which I know is very huge. I have also set it as sparse network.

library(maptools)
library(rgdal)
StreetsUTM=readShapeSpatial("cityIN_UTM")

#plot(StreetsUTM)
library(spatstat)
SS_StreetsUTM =as.psp(StreetsUTM)
SS_linnetUTM = as.linnet(SS_StreetsUTM, sparse=TRUE)

> SS_linnetUTM
Linear network with 321631 vertices and 341610 lines
Enclosing window: rectangle = [422130.9, 456359.7] x [4610458, 
4652536] units
> SS_linnetUTM$sparse
[1] TRUE

I have the following problems:

  1. It took 15-20 minutes to build psp object
  2. It took almost 5 hours to build the linnet object
  3. every time I want to analyse it for a point pattern or envelope, R crashes

I understand I should try to reduce the network size, but:

  1. I was wondering if there is a smart way to overcome this problem. Would rescaling help?
  2. How can I put it on more processing power?
  3. I am also curios to know if spatstat can be used with parallel package
  4. In the end, what are the limitations on network size for spatstat.

R crashes

R crashes when I use the instructions from Spatstat book:

  1. KN <- linearK(spiders, correction="none") ; on my network (linnet) of course

  2. envelope(spiders, linearK, correction="none", nsim=39); on my network

I do not think RAM is the problem, I have 16GB RAM and 2.5GhZ Dual core i5 processor on an SSD machine.

Could someone guide me please.

Upvotes: 0

Views: 111

Answers (2)

BKS
BKS

Reputation: 151

I could only resolve this with simplifying my network in QGIS with Douglas-Peucker algorithm in Simplify Geometries tool. So it is a slight compromise on the geometry of the linear network in the shapefile.

Upvotes: 0

Adrian Baddeley
Adrian Baddeley

Reputation: 1984

Please be more specific about the commands you used.

Did you build the linnet object from a psp object using as.linnet.psp (in which case the connectivity of the network must be guessed, and this can take a long time), or did you have information about the connectivity of the network that you passed to the linnet() command?

Exactly what commands to "analyse it for a point pattern or envelope" cause a crash, and what kind of crash?

The code for linear networks in spatstat is research code which is still under development. Faster algorithms for the K-function will be released soon.

Upvotes: 0

Related Questions