Skip to content
Back to formatted view

Raw Message

Message-ID: <111B5DD8-7429-4435-9BF3-0CB9FFA1E915@wsl.ch>
Date: 2012-01-26T16:30:17Z
From: Rafael Wüest
Subject: Area of Spatial Pixels
In-Reply-To: <AAD1945C8FDCF0488D845356BF31DB72023590C96F@WINEXCHANGE5.win.dtu.dk>

Hi Mark

If you create a raster via

r<-raster(bath)

you can use the area function of the raster package.

check out ?area

Rafael

On 26.01.2012, at 17:14, Mark Payne wrote:

> 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
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



--
Rafael W?est
Swiss Federal Research Institute WSL
Z?rcherstrasse 111
8903 Birmensdorf
Switzerland

+41 44 7392126
rafael.wueest at wsl.ch
http://www.wsl.ch/info/mitarbeitende/wueest