[R-sig-Geo] Obtaining 3d surface area using polygon layer and DEM grid

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Wed Apr 14 19:09:00 CEST 2010


On Wed, Apr 14, 2010 at 5:03 PM, Barry Rowlingson
<b.rowlingson at lancaster.ac.uk> wrote:

>  Not sure what to do about missing values, but that would be the way
> to deal with non-rectangular areas. An NA cell would obviously
> contribute 0 to the total surface, but it also affects the calculation
> of surface areas for the eight adjacent cells.
>
>  Currently it's just C code called with .C, so dealing with NA is
> inherently troublesome anyway! Maybe I can rewrite to use .Call, but
> there's a cricket match on...

 Right, well I didn't realise you could call ISNA(x) from .C code.
I've just implemented something for handling NA...

 When considering a cell with an NA value, the area contribution is
zero (whatever its neighbours are)

 When considering a non-NA cell with NA-valued neighbours, pretend the
neighbour cell had the same value as the considered cell.

 I've implemented this, and it seems to be consistent with
expectations... Will sort out docs tomorrow.

Barry



More information about the R-sig-Geo mailing list