powered by
For a given LineString or MultiLineString geometry, calculate its length. Other geometries will return a value of NA.
NA
length_euclidean(x)length_geodesic(x)length_vincenty(x)length_haversine(x)
length_geodesic(x)
length_vincenty(x)
length_haversine(x)
A numeric vector
an object of class rsgeo
rsgeo
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.
geo
set.seed(0) y <- runif(25, -5, 5) x <- 1:25 ln <- geom_linestring(x, y) length_euclidean(ln) length_geodesic(ln) length_vincenty(ln) length_haversine(ln)
Run the code above in your browser using DataLab