[R-sig-Geo] Calculating areas from point data?

Roger Bivand Roger.Bivand at nhh.no
Mon Oct 25 10:08:51 CEST 2010


On Sun, 24 Oct 2010, Alexander Shenkin wrote:

> Hello All,
>
> I laid out polygons based on a transect tape, and perpendicular
> distances from that tape.  So, for example, one polygon could be 48m
> long, at 10m, one point lies 5m to the right, at 15m another point lies
> 8m to the left, etc.  Connecting those points creates the polygon.
>
> I am interested in calculating the area of those polygons.  I'm not sure
> if R has a package that makes such calculations, or if I'd be better off
> using something else - I'm really not sure where to turn to do this.
> Any suggestions would be greatly appreciated.

library(sp)
x <- c(0, 15, 48, 10, 0)
y <- c(0, -8, 0, 5, 0)
slot(Polygon(cbind(x, y)), "area")

or:

library(spatstat)
owin(poly=list(x=x[-5], y=y[-5]))$bdry[[1]]$area

both work, treating the tape line as the x axis, and perpendicular 
distances from it as the y axis.

Hope this helps,

Roger

>
> Thanks,
> Allie
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list