how to convert list of psp objects to linnet

154 views Asked by At

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

2

There are 2 answers

0
BKS On BEST ANSWER

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

0
iHermes On

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