Skip to main content
Version: Next

bezierSpline

Description

Takes a line and returns a curved version by applying a Bezier spline algorithm.

The bezier spline implementation is by Leszek Rybicki.

Parameters

NameTypeDescription
lineFeature<LineString>input LineString
options?ObjectOptional parameters (default {})
options.properties?ObjectTranslate properties to output (default {})
options.resolution?numbertime in milliseconds between points (default 10000)
options.sharpness?numbera measure of how curvy the path should be between splines (default 0.85)

Returns

Examples

var line = turf.lineString([
[-76.091308, 18.427501],
[-76.695556, 18.729501],
[-76.552734, 19.40443],
[-74.61914, 19.134789],
[-73.652343, 20.07657],
[-73.157958, 20.210656],
]);

var curved = turf.bezierSpline(line);

Installation

$ npm install @turf/bezier-spline

import { bezierSpline } from "@turf/bezier-spline";
const result = bezierSpline(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.bezierSpline(...);