lawn_pt2line_distance: Minimum distance between a point and a lineString

Description Usage Arguments Value See Also Examples

View source: R/point_pt2line_distance.R

Description

Returns the minimum distance between a data-Point and a data-LineString, being the distance from a line the minimum distance between the point and any segment of the LineString.

Usage

1
2
3
4
5
6
7
lawn_pt2line_distance(
  point,
  line,
  units = "kilometers",
  mercator = FALSE,
  lint = FALSE
)

Arguments

point

(data-Feature<(data-Point)>) feature or geometry

line

Line to measure, a data-Feature<(data-LineString)>, or data-FeatureCollection<(data-LineString)>

units

(character) Can be degrees, radians, miles, or kilometers (default)

mercator

(logical) if distance should be on Mercator or WGS84 projection. Default: FALSE

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: FALSE

Value

distance between point and line (numeric)

See Also

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_line_distance(), lawn_midpoint(), lawn_point_on_feature(), lawn_square()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
pt <- lawn_point("[0, 0]")
ln <- lawn_linestring("[[1, 1],[-1, 1]]")

lawn_pt2line_distance(pt, ln)
lawn_pt2line_distance(pt, ln, mercator = TRUE)

lawn_pt2line_distance(pt, ln, 'miles')
lawn_pt2line_distance(pt, ln, 'radians')
lawn_pt2line_distance(pt, ln, 'degrees')
lawn_pt2line_distance(pt, ln, mercator = TRUE)

lawn documentation built on Jan. 6, 2021, 5:07 p.m.