lawn_along: Get a point at a distance along a line

Description Usage Arguments Value See Also Examples

View source: R/along.R

Description

Takes a data-LineString and returns a data-Point at a specified distance along the line.

Usage

1
lawn_along(line, distance, units, lint = FALSE)

Arguments

line

An input data-LineString.

distance

Distance along the line.

units

Units for the distance argument. 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: FALSE

Value

A data-Point distance units along the line.

See Also

Other measurements: 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_pt2line_distance(), lawn_square()

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
pts <- '[
   [-21.964416, 64.148203],
   [-21.956176, 64.141316],
   [-21.93901, 64.135924],
   [-21.927337, 64.136673]
]'
lawn_along(lawn_linestring(pts), 1, 'miles')

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_along(line, distance = 1, units = 'miles')
## Not run: 
lawn_along(lawn_linestring(pts), 1, 'miles') %>% view
res <- lawn_along(lawn_linestring(pts), 1, 'miles')
lawn_featurecollection(list(res, lawn_linestring(pts))) %>% view

## End(Not run)

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