sl.polygon.area: Compute Polygon Area on Sphere

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/sl.polygon.area.R

Description

Compute the area of a polygon on a sphere.

Usage

1
sl.polygon.area(stamp.lon, stamp.lat, ref.lon = NA, ref.lat = NA)

Arguments

stamp.lon

a vector specifying the longitudes of the polygon vertices.

stamp.lat

a vector specifying the latitudes of the polygon vertices.

ref.lon

optionally, a scalar specifying the longitude of the reference point from which the polygon is decomposed into triangles. If not specified, the longitude of the barycenter of the vertices will be used.

ref.lat

optionally, a scalar specifying the latitude of the reference point from which the polygon is decomposed into triangles. If not specified, the latitude of the barycenter of the vertices will be used.

small

a logical value indicating whether or not to use sl.smalltriag.area. If FALSE (default), sl.triag.area will be used, which should be preferred for relatively large polygons (spanning more than a degree or so).

absval

a logical value indicating whether or not to return an absolute value (consistent with the usual definition of an 'area'; default). If set to FALSE, the sign of the result depends on the direction of rotation of the polygon: counterclockwise gives a positive result, and clockwise gives a negative result.

Details

First the polygon is decomposed into triangles from a reference point. The latter can be specified by the correspoding arguments; otherwise, the barycenter of the polygon vertices will be used. Second the area of each triangle is computed using sl.triag.area or sl.smalltriag.area (depending on the argument small) and multiplied by the triangle's direction of rotation using sl.checkposition. Third the results are summed up.

Value

A scalar giving the area of the poygon (on a unit sphere). If absval=TRUE, the return value is always positive (or zero) as one should expect; otherwise, a positive (negative) return value indicates that the direction of rotation of the polygon is counterclockwise (clockwise).

Author(s)

Helge Goessling

See Also

sl.triag.area, sl.smalltriag.area

Examples

1
2
3
sl.polygon.area(stamp.lon=c(0,1,1,0),stamp.lat=c(0,0,1,1))
## Should return:
## [1] 0.0003046097

helgegoessling/spheRlab documentation built on Sept. 29, 2017, 6:36 a.m.