0

Using shapefiles vignette of spatstat, I was able to create a list of psp objects such that each feature of shapefile is a element in this psp list with the attributes as marks. To be specific, I used section 3.2.4 in the vignette as follows

> x<- readShapeSpatial("includes/roadshapefile.shp") 
> out <- lapply(x@lines, function(z) { lapply(z@Lines, as.psp) })
> dat <- x@data
> for(i in seq(nrow(dat)))
+ out[[i]] <- lapply(out[[i]], "marks<-", value=dat[i, , drop=FALSE])
> roadlist <- do.call("c", out)

Now i would like to create a whole network linnet from this list of psp objects. Is there a direct function or do I need to loop through each of the psp object to make each one a linnet and then somehow combine it to a complete network? as.linnet would not take this list of psp as a valid input because its class is a plain list.

I feel I am missing some small step. Could someone guide me please.

Once I have a linnet I want to create a point pattern using linfun and access these attributes (marks) to do a non-homogenous intensity of points.

Thanks

BKS
  • 141
  • 1
  • 10
  • Adrian Baddeley recently sent some `linnet` code to Roger Bivand who put it in the development version of `maptools` available at R-forge: http://r-forge.r-project.org/R/?group_id=943 maybe you can use this to get the linnet imported in an easier and faster way. I'm not sure how you can preserve the attributes and put them in an `linfun` or `linim` though. I will need to look into that. – Ege Rubak Jan 02 '17 at 14:49
  • Thank you. I will read through your reference. Could you then perhaps tell me how I may generate non-homogenous intensity on a network using spatstat ? I want to bring in atleast 2 attributes from a shapefile. Or is just one attribute possible before columns get discarded? – BKS Jan 02 '17 at 15:08
  • Thank you for the reference. I found the new function to create linnet from SpatialLines object but as you said, I lost the attributes :( – BKS Jan 02 '17 at 20:10

2 Answers2

0

This is resolved it seems, in latest version 1.37 I am able to preserve attributes. Thank you.

BKS
  • 141
  • 1
  • 10
0

Is there way to combine these roadlist back and create x again. In case we wanted add something in each line. Mainly I am asking for this reason.

data frame object to use as as.linnet object

iHermes
  • 314
  • 3
  • 12