Learn R Programming

sampSurf (version 0.7-6)

spCircle: Create a Circular Spatial Object

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

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.

Value

A list with the following components…

spCircle

The "'>SpatialPolygons" polygon object.

location

The "'>SpatialPoints" point object.

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.

See Also

The standingTree constructor.

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab