Working sample of https://github.com/Turfjs/turf/tree/master/packages/turf-bezier
// Sample based on https://github.com/Turfjs/turf/tree/master/packages/turf-bezier
// Using this as a starting point https://runkit.com/npm/turf
var turf = require("turf")
var line = {
"type": "Feature",
"properties": {
"stroke": "#f00"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
-66.126708984375,
18.47179400162541
],
[
-65.36865234375,
18.57596539447271
],
[
-64.94842529296875,
18.37016593904468
]
]
}
};
/*
* line Feature<LineString> input LineString
* resolution [number] time in milliseconds between points (optional, default 10000)
* sharpness [number] a measure of how curvy the path should be between splines (optional, default 0.85)
*/
var curved = turf.bezier(line, 10000, 0.85); // Defaults
curved.properties = { stroke: "#0f0", "line-color": "#f00" };
console.log(curved.geometry.coordinates.length);
console.log(JSON.stringify(curved));
var result = {
"type": "FeatureCollection",
"features": [line, curved]
};