Learn R Programming

lawn (version 0.5.0)

lawn_bezier: Curve a linestring

Description

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

Usage

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

Arguments

line
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

Run this code
# NOT RUN {
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
# }

Run the code above in your browser using DataLab