lawn_bezier: Curve a linestring

Description Usage Arguments Value See Also Examples

View source: R/bezier.R

Description

Takes a data-LineString and returns a curved version by applying a Bezier spline algorithm.

Usage

1
lawn_bezier(line, resolution = 10000L, sharpness = 0.85, lint = FALSE)

Arguments

line

A data-Feature with a single data-LineString

resolution

Time in milliseconds between points

sharpness

A measure of how curvy the path should be between splines

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-LineString curved line.

See Also

Other transformations: lawn_buffer(), lawn_concave(), lawn_convex(), lawn_difference(), lawn_intersect(), lawn_merge(), lawn_simplify(), lawn_union()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
pts <- '[
   [-21.964416, 64.148203],
   [-21.956176, 64.141316],
   [-21.93901, 64.135924],
   [-21.927337, 64.136673]
]'
lawn_bezier(lawn_linestring(pts))
lawn_bezier(lawn_linestring(pts), 9000L)
lawn_bezier(lawn_linestring(pts), 9000L, 0.65)
## Not run: 
lawn_bezier(lawn_linestring(pts)) %>% view
lawn_featurecollection(list(lawn_linestring(pts),
  lawn_bezier(lawn_linestring(pts)))) %>% view

## End(Not run)

Example output

<LineString>
  Bounding box: -22.0 64.1 -21.9 64.1
  No. points: 1000
  Properties: NULL
<LineString>
  Bounding box: -22.0 64.1 -21.9 64.1
  No. points: 900
  Properties: NULL
<LineString>
  Bounding box: -22.0 64.1 -21.9 64.1
  No. points: 900
  Properties: NULL

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