spCentroid: spCentroid

Description Usage Arguments Details Value See Also Examples

View source: R/spCentroid.R

Description

Aggregates a spatial object into regions.

Usage

1

Arguments

x

An object of class SpatialPoints or SpatialPolygons.

Details

Returns the centroid of each element in x.

Value

A spatialPointsDataFrame object.

See Also

ecDistance

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
{

require(raster)

# read raster data
r <- brick(system.file("extdata", "ndvi.tif", package="fieldRS"))

# read field data
data(fieldData)

# derive centroids
c <- spCentroid(fieldData)

# plot polygons and compare with centroids
plot(fieldData)
points(c, col="red")

}

RRemelgado/fieldRS documentation built on June 5, 2020, 1:48 p.m.