Description Usage Arguments Value See Also Examples
View source: R/line_distance.R
Takes a data-LineString and measures its length in the specified units. Uses turf/length internally as lineDistance was deprecated
1 | lawn_line_distance(line, units, lint = FALSE)
|
line |
Line to measure, a data-Feature<(data-LineString)>, or data-FeatureCollection<(data-LineString)> |
units |
Can be degrees, radians, miles, or kilometers. |
lint |
(logical) Lint or not. Uses geojsonhint. Takes up increasing
time as the object to get linted increases in size, so probably use by
default for small objects, but not for large if you know they are good
geojson objects. Default: |
Length of the input line (numeric).
Other measurements:
lawn_along()
,
lawn_area()
,
lawn_bbox_polygon()
,
lawn_bbox()
,
lawn_bearing()
,
lawn_center_of_mass()
,
lawn_center()
,
lawn_centroid()
,
lawn_destination()
,
lawn_distance()
,
lawn_envelope()
,
lawn_extent()
,
lawn_midpoint()
,
lawn_point_on_feature()
,
lawn_pt2line_distance()
,
lawn_square()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | line <- '{
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [
[-77.031669, 38.878605],
[-77.029609, 38.881946],
[-77.020339, 38.884084],
[-77.025661, 38.885821],
[-77.021884, 38.889563],
[-77.019824, 38.892368]
]
}
}'
lawn_line_distance(line, 'kilometers')
lawn_line_distance(line, 'miles')
lawn_line_distance(line, 'radians')
lawn_line_distance(line, 'degrees')
|
[1] 2.637684
[1] 1.638982
[1] 0.0004138843
[1] 0.02371382
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.