lawn_point_on_line: Get closest point on linestring to reference point

Description Usage Arguments Value Examples

View source: R/point_on_line.R

Description

Takes a line, a start data-Point, and a stop point and returns the line in between those points

Usage

1
lawn_point_on_line(line, point, lint = FALSE)

Arguments

line

data-Feature<(data-LineString)> to snap to

point

data-Feature<(data-Point)> to snap from

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

A data-Feature<(data-Point)>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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]
    ]
  }
}'
pt <- '{
  "type": "Feature",
  "properties": {},
  "geometry": {
    "type": "Point",
    "coordinates": [-77.037076, 38.884017]
  }
}'
lawn_point_on_line(line, pt)

# lint input objects
lawn_point_on_line(line, pt, TRUE)
## Not run: 
line %>% view
pt %>% view
lawn_point_on_line(line, pt) %>% view

## End(Not run)

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