circle.polygon {swfscMisc} | R Documentation |
Circle Polygon (on Earth)
Description
Creates a circular polygon (optionally on the earth) centered at a given point with a constant radius.
Usage
circle.polygon(
x,
y,
radius,
brng.limits = 0,
sides = 1,
by.length = TRUE,
units = "nm",
ellipsoid = datum(),
dist.method = "lawofcosines",
destination.type = "ellipsoid",
poly.type = "cart.earth"
)
Arguments
x , y |
number specifying the coordinates of the center of the circle in decimal degrees.
If |
radius |
radius of sphere. |
brng.limits |
number, or vector of two numbers. If one value is given, it is used as the starting bearing in degrees for the first point of the circle. If a vector of two values is given, then they are used as the start and end bearings of arc. |
sides |
number that represents either length of sides or number of sides, as specified by the 'by.length' argument. |
by.length |
logical. If |
units |
character for units of distance: Can be "km" (kilometers), "nm" (nautical miles), "mi" (statute miles). |
ellipsoid |
ellipsoid model parameters as returned from a call to |
dist.method |
character specifying method for calculating distance for |
destination.type |
character specifying type of surface for |
poly.type |
character specifying the type of polygon calculation to use. Can be one of "cartesian" using basic cartesian coordinates, "cart.earth" for a simple polygon on the earth's surface treating latitude and longitude as cartesian coordinates, or "gc.earth" for a more precise calculation keeping a constant great-circle radius. |
Value
A matrix representing the desired circle polygon centered at lat, lon of radius.
Author(s)
Eric Archer eric.archer@noaa.gov
Examples
cart.earth <- circle.polygon(-117.24, 32.86, 40, poly.type = "cart.earth")
lat.range <- c(32, 34)
lon.range <- c(-118.5, -116)
op <- par(mar = c(3, 5, 5, 5) + 0.1, oma = c(1, 1, 1, 1))
plot.new()
plot.window(xlim = lon.range, ylim = lat.range)
points(-117.24, 32.86, pch = 19, col = "red")
polygon(cart.earth, border = "red", lwd = 3)
lat.lon.axes(n = 3)
box(lwd = 2)
mtext("poly.type = 'cart.earth'", line = 3)
par(op)