Skip to content
Prev 23766 / 29559 Next

Extract points from SpatialLines objects along with the corresponding Lines' ID

On 04/12/15 16:49, Bastien Tran wrote:
Try:
Lines.NR Lines.ID Line.NR coords.x1 coords.x2
1        1        a       1         1       3.0
2        1        a       1         2       2.0
3        1        a       1         3       2.0
4        2        b       1         1       3.0
5        2        b       1         2       1.5
6        2        b       1         3       1.0

or alternatively:
$a
     [,1] [,2]
[1,]    1    3
[2,]    2    2
[3,]    3    2

$b
     [,1] [,2]
[1,]    1  3.0
[2,]    2  1.5
[3,]    3  1.0