So I have a spatialpolygons object in R; but I am not sure why I am unable to retrieve the "area" slot from it.
Here's my R session:
> spatialpolygons
An object of class "SpatialPolygons"
Slot "polygons":
[[1]]
An object of class "Polygons"
Slot "Polygons":
[[1]]
An object of class "Polygon"
Slot "labpt":
[1] 20.50516 57.72918
Slot "area":
[1] 36.85484
Slot "hole":
[1] FALSE
Slot "ringDir":
[1] 1
Slot "coords":
[,1] [,2]
[1,] 16.48438 59.73633
[2,] 22.59277 61.14258
[3,] 24.74609 55.03418
[4,] 17.49512 55.12207
[5,] 16.48438 59.73633
Slot "plotOrder":
[1] 1
Slot "labpt":
[1] 20.50516 57.72918
Slot "ID":
[1] "myMultiPolygons"
Slot "area":
[1] 36.85484
Slot "plotOrder":
[1] 1
Slot "bbox":
min max
x 16.48438 24.74609
y 55.03418 61.14258
Slot "proj4string":
CRS arguments:
+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0
> spatialpolygons@bbox
min max
x 16.48438 24.74609
y 55.03418 61.14258
> spatialpolygons@area
Error: no slot of name "area" for this object of class "SpatialPolygons"
> slotNames(spatialpolygons)
[1] "polygons" "plotOrder" "bbox" "proj4string"
> names(spatialpolygons)
[1] "myMultiPolygons"
spatialpolygons@polygons[[1]]@area
works. – Redwing