Question

I am working in the spatstat package in R and I would like to create an object of "linnet" (network) class from a shapefile. Unfortunately, while I am able to obtain the locations of all nodes in the network from the ArcGIS, I cannot figure out the way to obtain the list of edges or adjacency matrix, which are necessary to build an object of class "linnet" in spatstat. So how to obtain either one (list of edges in network or vertices adjacency matrix) is my question.

If you have any piece of code that deals with this problem, or any advice I would highly appreciate it.

Below is the description of the object class from the spatstat documentation.

Many thanks in advance,

Description Creates an object of class "linnet" representing a network of line segments. Usage linnet(vertices, m, edges) Arguments vertices - Point pattern (object of class "ppp") specifying the vertices of the network. m - Adjacency matrix. A matrix of logical values equal to TRUE when the corresponding vertices are joined by a line. (Specify either m or edges.) edges - Edge list. A two-column matrix of integers, specifying all pairs of vertices that should be joined by an edge. (Specify either m or edges.)

Was it helpful?

Solution

This is not possible. If you only know the locations of the nodes, the software cannot guess which nodes are connected by lines.

If you're starting from a shapefile you need to extract the lines of the network and convert them to a spatstat class "psp" object (planar segment pattern). Then you can use as.linnet to form the network.

See Chapter 17 of the spatstat book

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top