Class for spatial attributes that correspond to point sets

# S4 method for class 'SpatialMultiPointsDataFrame'
x[i, j, ..., drop = TRUE]
  # S4 method for class 'SpatialMultiPointsDataFrame,data.frame'
coerce(from, to, strict=TRUE)
  # S4 method for class 'SpatialMultiPointsDataFrame'
coordinates(obj)
  # S4 method for class 'SpatialMultiPointsDataFrame'
show(object)
  # S4 method for class 'SpatialMultiPointsDataFrame'
points(x)

Slots

data:

Object of class data.frame containing the attribute data (may or may not contain the coordinates in its columns)

coords:

Object of class "list"; the list with coordinates matrices; points are rows in the matrix, the list length equals the number of rows in the data slot

bbox:

Object of class "matrix"; bounding box

proj4string:

Object of class "CRS"; projection string

Extends

Class "SpatialMultiPoints", directly. Class "Spatial", by class "SpatialMultiPoints".

Arguments

x,from,obj,object

SpatialMultiPointsDataFrame object

to

class to which to coerce

strict

see as

i

row indices

j

column indices

drop

see Extract

...

indices passed through

Author

Edzer Pebesma, edzer.pebesma@uni-muenster.de

Examples

# create three sets of points:
cl1 = cbind(rnorm(3, 10), rnorm(3, 10))
cl2 = cbind(rnorm(5, 10), rnorm(5,  0))
cl3 = cbind(rnorm(7,  0), rnorm(7, 10))

mpdf = SpatialMultiPointsDataFrame(list(cl1, cl2, cl3), data.frame(a = 1:3))
mpdf
#>                 coordinates a
#> 1      (6.999186, 11.63942) 1
#> 1.1     (9.114098, 9.73929) 1
#> 1.2    (9.244407, 9.468115) 1
#> 2     (10.91314, 0.7406445) 2
#> 2.1  (10.41878, -0.4293515) 2
#> 2.2   (10.04003, 0.1892378) 2
#> 2.3  (12.47047, -0.5419215) 2
#> 2.4    (12.08481, -2.11942) 2
#> 3    (-0.1641934, 10.40547) 3
#> 3.1  (-0.3492128, 9.604582) 3
#> 3.2   (0.2409091, 8.875999) 3
#> 3.3   (0.5166673, 9.515874) 3
#> 3.4    (1.107692, 9.558087) 3
#> 3.5  (-0.8673017, 9.815958) 3
#> 3.6 (0.001145948, 9.319365) 3

plot(mpdf, col = mpdf$a, cex = 1:3)

as(mpdf, "data.frame")
#>                X1         X2 index a
#> X1    6.999186017 11.6394230     1 1
#> X1.1  9.114097753  9.7392898     1 1
#> X1.2  9.244406967  9.4681146     1 1
#> X2   10.913139182  0.7406445     2 2
#> X2.1 10.418777268 -0.4293515     2 2
#> X2.2 10.040033023  0.1892378     2 2
#> X2.3 12.470472345 -0.5419215     2 2
#> X2.4 12.084811553 -2.1194197     2 2
#> X3   -0.164193423 10.4054721     3 3
#> X3.1 -0.349212773  9.6045823     3 3
#> X3.2  0.240909140  8.8759995     3 3
#> X3.3  0.516667272  9.5158739     3 3
#> X3.4  1.107692224  9.5580871     3 3
#> X3.5 -0.867301692  9.8159578     3 3
#> X3.6  0.001145948  9.3193653     3 3
mpdf[1:2,]
#>                coordinates a
#> 1     (6.999186, 11.63942) 1
#> 1.1    (9.114098, 9.73929) 1
#> 1.2   (9.244407, 9.468115) 1
#> 2    (10.91314, 0.7406445) 2
#> 2.1 (10.41878, -0.4293515) 2
#> 2.2  (10.04003, 0.1892378) 2
#> 2.3 (12.47047, -0.5419215) 2
#> 2.4   (12.08481, -2.11942) 2