turf.lineArc
What is turf.lineArc?
turf.lineArc returns a LineString that traces an arc on a circle of given radius between bearing1 and bearing2 around a centre Point. It is the line-drawing counterpart to turf.sector (which returns a polygon).
turf.lineArc(center, radius, bearing1, bearing2, options?) → Feature<LineString>Options include:
steps— number of vertices along the arc (default64)units—'kilometers'(default),'meters','miles','nauticalmiles','radians','degrees'
When would you use turf.lineArc?
Use turf.lineArc to render partial-circle arcs on a map — the perimeter of a radar sweep, a weather warning arc, or the outline of a directional coverage zone. On MapLibre it works as a line source that can be styled as a rendered curve between two bearings.
In Node.js it is useful when pre-generating directional overlays for batch rendering, or when building the arc component of a compound sector shape.
undefinedFAQs
How is this different from turf.sector?
turf.lineArc returns a LineString following only the arc. turf.sector returns a closed Polygon (arc + two radial edges forming a pie slice). Pick whichever matches your rendering intent.
How do I install just lineArc?
npm install @turf/line-arc. It depends on @turf/destination and @turf/helpers.
Can bearing2 be less than bearing1?
Yes — arcs wrap correctly around 360°. For a full circle, use turf.circle instead, which is purpose-built and faster.
How do I render it on MapLibre?
Add it to a GeoJSON source and render with a line style layer. For animation effects (sweeping arcs), update the source data each frame with new bearing1/bearing2 values.