Learn R Programming

geosphere (version 1.2.1)

makePoly: make a polygon

Description

Make a polygon by adding intermedate points (vertices) inbetween the points supplied. This is relevant when vertices are relativly far apart. It can assure the shape of the polygon to be accurate, when plotted on a plane, is accurate.

Usage

makePoly(p, interval=10000, r=6378137, sp=FALSE)

Arguments

p
a 2-column matrix (longitude/latitude)
interval
maximum interval of points, in units of r
r
radius of the earth; default = 6378137
sp
Logical. If TRUE, a SpatialPolygons object is retunred (depends on the 'sp' package)

Value

  • A matrix

Examples

Run this code
pol <- rbind(c(-180,-20), c(-160,5), c(-60, 0), c(-160,-60), c(-180,-20))
plot(pol)
lines(pol, col='red', lwd=3)
pol2 = makePoly(pol, interval=100000)
lines(pol2, col='blue', lwd=2)

Run the code above in your browser using DataLab