I'd like to open a popup in on the midpoint of a polyline/linestring in Mapbox GL, like it's the default case in Leaflet.
How can I do this via turf.js? If I use centroid/center/centerOfMass it will get a point usually not on the line, but somewhere next to it.
My only idea is to:
- Measure the lenght of the line in some units
- Use
along()with the half of the measured distance.
Is this really the best option?


