如何确定shapefile的区域?
当我使用summary(data)
时,它会给出区域,但是我不知道每个shapefile多边形的区域是什么。
此外,该区域可以转换为米?
答案 0 :(得分:8)
# load the rgeos library
library(rgeos)
# make a polygon (borrowed from ref manual for package)
sample_poly <- readWKT("POLYGON((0 1,0.95 0.31,0.59 -0.81,-0.59 -0.81,-0.95 0.31,0 1))")
# and calculate the area
gArea(sample_poly)
[1] 2.3803
答案 1 :(得分:2)
data@polygons[[1]]@Polygons[[1]]@area
data@polygons[[2]]@Polygons[[1]]@area
将为您提供第一个和第二个多边形的区域,您可以通过for循环给出所有或向我们显示名称:
names(data)