spCircle: Create a Circular Spatial Object

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

View source: R/spCircle.R

Description

This function simply creates a circular polygon object that is of class "SpatialPolygons". It also creates a "SpatialPoints" object holding the center point of the circle.

Usage

1
2
3
4
5
6
spCircle(radius,
         spUnits = CRS(projargs = as.character(NA)),
         centerPoint = c(x = 0, y = 0),
         nptsPerimeter = 100,
         spID = paste("circle", .StemEnv$randomID(), sep = ":"),
         ...)

Arguments

radius

The radius of the circle in the appropriate units.

spUnits

Object of class "CRS": A legal proj.4 coordinate system; the default is to have user-defined coordinates.

centerPoint

The circle's center location in the appropriate units. This is a vector of length two with names "x" and "y".

nptsPerimeter

The number of points forming the perimeter of the polygon.

spID

A unique identifier that will be used in displaying the spatial polygon.

...

Not used currently.

Details

The polygon created for the circle will always have the individual internal "Polygon" object named ‘pgCircle’, while the internal "Polygons" object will be named ‘pgsCircle’. These may need to be renamed in the returned object to make more sense. See the sp package for more details.

Value

A list with the following components...

spCircle

The "SpatialPolygons" polygon object.

location

The "SpatialPoints" point object.

Author(s)

Jeffrey H. Gove

See Also

The standingTree constructor.

Examples

1
2
3
4
dbh = 20
sp.dbh = spCircle(dbh/2, centerPoint=c(x=30,y=80), spID='tree.1') 
plot(sp.dbh$spCircle)
plot(sp.dbh$location, add=TRUE, pch=3)

Example output

Loading required package: sp
Loading required package: raster
Loading required package: rasterVis
Loading required package: lattice
Loading required package: latticeExtra
Loading required package: RColorBrewer
Loading required package: boot

Attaching package: 'boot'

The following object is masked from 'package:lattice':

    melanoma

sampSurf version 0.7-3 (2015-04-14)

sampSurf documentation built on March 5, 2021, 5:06 p.m.