Learn R Programming

sp (version 2.1-4)

SpatialLines-class: a class for spatial lines

Description

a class that holds spatial lines

Objects from the Class

hold a list of Lines objects; each Lines object holds a list of Line (line) objects.

Slots

lines:

Object of class "list"; list members are all of class Lines-class

bbox:

Object of class "matrix"; see Spatial-class

proj4string:

Object of class "CRS"; see CRS-class

Extends

Class "Spatial", directly.

Methods

[

signature(obj = "SpatialLines"): select subset of (sets of) lines; NAs are not permitted in the row index

coordinates

value is a list of lists with matrices

plot

signature(x = "SpatialLines", y = "missing"): plot lines in SpatialLines object

lines

signature(x = "SpatialLines"): add lines in SpatialLines object to a plot

rbind

signature(object = "SpatialLines"): rbind-like method, see notes

summary

signature(object = "SpatialLines"): summarize object

plot method arguments

The plot method for “SpatialLines” objects takes the following arguments:

x

object of class SpatialLines

xlim

default NULL; the x limits (x1, x2) of the plot

ylim

default NULL; the y limits of the plot

col

default 1; default plotting color

lwd

default 1; line width

lty

default 1; line type

add

default FALSE; add to existing plot

axes

default FALSE; a logical value indicating whether both axes should be drawn

lend

default 0; line end style

ljoin

default 0; line join style

lmitre

default 10; line mitre limit

...

passed through

setParUsrBB

set the par “usr” bounding box, see note in Spatial-class

Author

Roger Bivand, Edzer Pebesma

See Also

Line-class, Lines-class

Examples

Run this code
# from the sp vignette:
l1 = cbind(c(1,2,3),c(3,2,2))
rownames(l1) = letters[1:3]
l1a = cbind(l1[,1]+.05,l1[,2]+.05)
rownames(l1a) = letters[1:3]
l2 = cbind(c(1,2,3),c(1,1.5,1))
rownames(l2) = letters[1:3]
Sl1 = Line(l1)
Sl1a = Line(l1a)
Sl2 = Line(l2)
S1 = Lines(list(Sl1, Sl1a), ID="a")
S2 = Lines(list(Sl2), ID="b")
Sl = SpatialLines(list(S1,S2))
summary(Sl)
plot(Sl, col = c("red", "blue"))

Run the code above in your browser using DataLab