[R-sig-Geo] Area of Spatial Pixels

Mark Payne mpa at aqua.dtu.dk
Thu Jan 26 17:14:18 CET 2012


Dear R spatial gurus,

I am new to the spatial classes in R, but have been very impressed by what I've seen so far. Hopefully this question isn't too simple but I haven't been able to find the answer in either the mailing lists or documentation...

I have created a SpatialPixelsDataFrame as follows:

> summary(bath)
Object of class SpatialPixelsDataFrame
Coordinates:
     min max
lon -180 180
lat  -90  90
Is projected: FALSE
proj4string : [+proj=longlat +datum=WGS84]
Number of points: 64800
Grid attributes:
    cellcentre.offset cellsize cells.dim
lon            -179.5        1       360
lat             -89.5        1       180
Data attributes:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
-7473.0 -4286.0 -2514.0 -1896.0   233.2  5731.0
>

This object represents the ocean bathymetry on  a global 1 degree grid. I would like to calculate the area of each pixel in this object (for use in further calculations), but can't figure out how to do it. Is there an easy and direct way to achieve this?

Best wishes,

Mark


More information about the R-sig-Geo mailing list