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.85323516315266, y: 0.5487884624330192 }))  
#> [2] Point(Coord { x: 43.28121065833406, y: -0.9099755665119409 })) 
#> [3] Point(Coord { x: 50.722853340740315, y: 0.6575253615073913 })) 
#> [4] Point(Coord { x: 48.81807331672222, y: -0.43884191432112574 }))
#> [5] Point(Coord { x: 51.64827952415451, y: 1.15103438249401 }))