Learn R Programming

adehabitatMA (version 0.3.17)

calcperimeter: Compute Perimeters of Objects of Class "SpatialPolygonsDataFrame" and "PolyLinesDataFrame"

Description

calcperimeter computes the perimeters of polygons in objects of class SpatialPolygonsDataFrame and PolyLinesDataFrame.

Usage

calcperimeter(x)

Value

an object of class SpatialPolygonsDataFrame or

PolyLinesDataFrame with an additionnal column containing the perimeter of the polygons/polylines.

Arguments

x

object of class SpatialPolygonsDataFrame or PolyLinesDataFrame

Author

Clement Calenge clement.calenge@ofb.gouv.fr

See Also

SpatialPolygonsDataFrame-class for additionnal information on objects of class SpatialPolygonsDataFrame.

Examples

Run this code
data(meuse.grid)
a <- SpatialPixelsDataFrame(points = meuse.grid[c("x", "y")],
                            data = meuse.grid)


## the contour of the map
gc <- getcontour(a[,1])
plot(gc)

## Transforms the SpatialPolygons into SpatialPolygonsDataFrame
gc <- SpatialPolygonsDataFrame(gc, data.frame(x=1))

## The perimeter of this map (in units of the data):
ii <- calcperimeter(gc)
as.data.frame(ii)



Run the code above in your browser using DataLab