For a given LineString or MultiLineString geometry, calculate its length.
Other geometries will return a value of NA
.
Details
Notes
Vicenty, Geodesic, and Haversine methods will return in units of meters.
Geodesic length will always converge and is more accurate than the Vicenty methods.
Haversine uses a mean earth radius of 6371.088 km.
See geo
docs for more details.
Examples
set.seed(0)
y <- runif(25, -5, 5)
x <- 1:25
ln <- geom_linestring(x, y)
length_euclidean(ln)
#> [1] 91.41732
length_geodesic(ln)
#> [1] 10114260
length_vincenty(ln)
#> [1] 10114260
length_haversine(ln)
#> [1] 10164090