how to export r spatstat linnet object to esri shapefile

257 views Asked by At

I converted a shapefile into linnet object following some threads on this forum. I did some analysis,Now, I would like to convert this linnet object (linear network) of spatstat R package back to ESRI shapefile format. Could someone give me some hints to achieve this task.

For example, I would generate some random realisation of poisson process on linear network then would like to export the id of the segment and location of the point event on this segments. It seems possible to export this information as textual information but I was wondering if it could "also" be a geographic export (line shapefile of the linnet object and point shapefile of the random realisation)

Thank you.

1

There are 1 answers

0
Ege Rubak On BEST ANSWER

You can use functions from maptools to convert a psp back to a SpatialLines object and a ppp to a SpatialPoints. Using the built in dataset chicago as an example (including the intermediate step of converting a lpp to both a psp and a ppp:

library(spatstat)
library(maptools)
chicago_psp <- as.psp(chicago)
chicago_sl <- as.SpatialLines.psp(chicago_psp)
chicago_ppp <- as.ppp(chicago)
chicago_sp <- as.SpatialPoints.ppp(chicago_ppp)