Given a vector of geometries, extract their centroids.
Examples
lns <- geom_linestring(1:100, runif(100, -10, 10), rep.int(1:5, 20))
centroids(lns)
#> <rs_POINT[5]>
#> [1] Point(Coord { x: 55.30438962049526, y: -0.7968826140458218 }))
#> [2] Point(Coord { x: 49.019771239989446, y: 0.437658653051966 }))
#> [3] Point(Coord { x: 50.24532372103153, y: 1.9188131319181634 }))
#> [4] Point(Coord { x: 51.379459556926825, y: 0.29679717348388024 }))
#> [5] Point(Coord { x: 53.57615485864889, y: -0.42141184913509694 }))