Skip to contents

Given a vector of geometries, extract their centroids.

Usage

centroids(x)

Arguments

x

an object of class rsgeo

Value

an object of class rs_POINT

Examples

lns <- geom_linestring(1:100, runif(100, -10, 10), rep.int(1:5, 20))
centroids(lns)
#> <rs_POINT[5]>
#> [1] Point(Coord { x: 50.057810775242736, y: 0.7390039127145581 }))  
#> [2] Point(Coord { x: 46.344887396242925, y: -0.28778672605281075 }))
#> [3] Point(Coord { x: 52.26359686891052, y: 0.32212848527359284 }))  
#> [4] Point(Coord { x: 48.573421117106406, y: -0.8096019381771609 })) 
#> [5] Point(Coord { x: 53.09166374333488, y: -1.3873416432893086 }))