Background
We are supplied with some AIXM data (an XML based superset of GML) which describes polygon areas on a map as a mix of GeodesicStrings (a list of coordinates) and ArcByCentrePoints (a centre point coordinate with a radius, start bearing and end bearing). We are taking this data and converting it into a simple list of coordinates that we then display using a Google maps polyline.
Problem
When we plot a shape with an arc, the start and end points of the arc usually don't match up with the end point of the preceding line and the start point of the subsequent line. It looks as if the radial distance is out by an amount which doesn't appear to be proportional to the radius. See screenshot: interestingly the smaller arc at the top seems fine but the larger arc is inset.

We're pretty sure the data is correct because it looks fine when we use a third party tool to visualise it, so we're doing something wrong.
Implementation
We are using turf.js to convert the arc description into a set of points using the lineArc function. We combine these generated points, in the correct sequence, with the points taken directly from the preceding and subsequent GeodesicString elements to give us our final polygon.
Data
Input: Fragment of AIXM (GML) describing polygon
Output: Resulting list of points
I'm wondering if it could be to do with the fact that lineArc / destination uses the Haversine function...
Hey @jgwconsulting, you might wanna try @turf/rhumb-distance or @turf/rhumb-destinationfor your calculations, as those modules calculate values along geodesic lines.
@stebogit big thanks for your reply and suggestion - that sounds like it could well be the solution! I'll give it a try ASAP and report back 馃憤
I temporarily modified line-arc to use rhumb-destination and retested (ensuring that it was actually calling rhumbDestination) and, unfortunately, the results are the same with the rendered arc falling short of the expected points. I'd really appreciate any other ideas you might have...
would you please send a snippet of how you are actually doing your calculations? that would be really helpful
@stebogit thanks for your patience and help with something that may turn out not to be a problem with Turf.js at all. I'll put together a cut-down recreation of the problem in CodePen or similar... :)
Hey, so I've created a sandbox example of the problem we're having with lineArc. We start with AIXM format XML which we transform into JSON resulting in this: https://codepen.io/jeromewilson/pen/JeGRMw
The code to process this JSON, turn it into a set of coordinates and render onto Google Maps, is here: https://codepen.io/jeromewilson/pen/GYzOBV
You'll see it shows the problem whereby the end points of the arc don't meet the end points of the preceding and subsequent lines. Hope you might have a chance to look at this sometime @stebogit
Thanks!
I've condensed the code further to demonstrate just the problem we're experiencing, without all the additional code - self contained with no JSON dependency: https://codepen.io/jeromewilson/pen/YREVLX
@jgwconsulting take a look at this, I only reduced the code to make it simpler: https://jsfiddle.net/jStefano/d8ru2kjz/
Looks like the rendering on geojson.io is much better, although not perfect. It might be an issue on Google Map instead?

Stefano, you're an absolute superstar! I've taken those generated coordinates and plotted them with Google Maps here: https://codepen.io/jeromewilson/pen/rQYojM
As you can see it looks the same as when it's rendered with geojson.io (except it's joining up that final point but I think we can ignore that). I think that means that the slight differences in code between our parseArcByCenterPoint functions are the source of the discrepancy - maybe rounding errors or something.
Anyway, that gives me something to work on. I really appreciate your help with this - if you're ever in Bristol (UK) all of the beers are on me.
Oh God, having thought it must be something complex to do with the Haversine formula or some sort of projection issue it turns out the problem was actually this...

Thanks again for all your help and, genuinely, if you're ever in Bristol give me a shout: jeromewilson at clara dot co dot uk.
@jgwconsulting glad I could help! 馃槣