Learn R Programming

R2G2 (version 1.0-2)

GetEdges: Computing the edges of any n-sided regular polygon on a sphere

Description

Provides the edges coordinates for one n-sided regular polygon, corrected to account for the earth curvature.

Usage

GetEdges(center, radius, nedges, orient = 45)

Arguments

center
The geographical position of the polygon as c(lon, lat) in decimal degrees.
radius
The polygon radius (in meters).
nedges
The number of edges (3 -> triangle, 4 -> square, etc).
orient
The rotation factor of the polygon (in degrees).

Value

Provides an array of coordinates for the n-edges defining the desired polygon (lines = points delimiting the polygon, columns = lon, lat in decimal degrees).

Details

Earth-curvature corrections are assuming a sphere, hence expect some deformations near to the poles. In addition, polygons that overlap with the poles will have missing values (i.e. when center coordinates + radius lead to overeach a pole).

References

This function was retrieved as a PHP code from http://blog.thematicmapping.org/ This is an amazing blog; the R2G2 dvpt team thanks a lot Bjorn Sandvik for his outstanding implementations in Google Earth, and for sharing his great ideas and resources. GetEdges is actually an R implementation of his material.

See Also

Hist2GE Pies2GE Shapes2GE curvy