JSFiddle - React, Tailwind, and code Playground
by sakshibhasin96
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/Turf.js/6.5.0/turf.min.js"></script>
JavaScript
// Without npoints
const fromLat = -33.868801, fromLng = 151.209305
const toLat = 34.052235, toLng = -118.243683
const feature = turf.greatCircle([fromLng, fromLat], [toLng, toLat])
console.log(feature)
// With npoints
/* const MAX_POINTS_PER_LINE = 20
const fromLat = -33.868801, fromLng = 151.209305
const toLat = 34.052235, toLng = -118.243683
const feature = turf.greatCircle([fromLng, fromLat], [toLng, toLat], {
npoints: MAX_POINTS_PER_LINE,
})
console.log(feature) */