[R-sig-Geo] Calculating areas on Earth?s surface

Matthew Vavrek matthew at matthewvavrek.com
Fri Jul 22 20:14:38 CEST 2011


Karl,

have you looked at the PBSmapping package? It has a calcArea() function 
that might do what you need it to do. However, you need to get your data 
converted to a PolySet rather than a SpatialPolygons object.

library(sp)
library(rgdal)
library(maptools) #provides the SpaltialPolygons to PolySet converter
library(PBSmapping)

unproj=CRS("+init=epsg:4326")
xy=GridTopology(c(0,55),c(8, 4), c(5,5))
xy=as.SpatialPolygons.GridTopology(xy, unproj)

#convert to PolySet
ps.xy<-SpatialPolygons2PolySet(xy)
ps.xy<-as.PolySet(ps.xy, 'LL')
calcArea(ps.xy)

Cheers
Matthew



More information about the R-sig-Geo mailing list