
Last chance! 50% off unlimited learning
Sale ends in
Creates a circular polygon (optionally on the earth) centered at a given point with a constant radius.
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"
)
A matrix representing the desired circle polygon centered at lat, lon of radius.
number specifying the coordinates of the center of the circle in decimal degrees.
If poly.type
is "simple.earth" or "complex.earth", this will be longitude and
latitude respectively.
radius of sphere.
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.
number that represents either length of sides or number of sides, as specified by the 'by.length' argument.
logical. If TRUE
, then sides
is the length of sides, if
FALSE
, then sides
is number of sides.
character for units of distance: Can be "km" (kilometers), "nm" (nautical miles), "mi" (statute miles).
ellipsoid model parameters as returned from a call to datum
.
character specifying method for calculating distance for type
= "cart.earth".
See method
argument of distance
for more information.
character specifying type of surface for type
= "gc.earth".
See type
argument of destination
for more information.
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.
Eric Archer eric.archer@noaa.gov
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))
maps::map("mapdata::worldHires", fill = TRUE, col = "wheat3", 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)
Run the code above in your browser using DataLab