I'm using ArcGIS Pro and would prefer solutions using ArcPy, ArcMap, or ArcGIS Pro, but an open source alternative may work too.
I'm trying to construct a line from a series of points using the Points to Line tool. This works well if the points are all in some sort of order as given by the attributes table or their ObjectID; but if points are added out of order, the line is then constructed out of order as well, as seen in the image below after using Points to Line. The intended image looks like a smooth 'S' curve. (This is a simple example based off of more complex multiple points/lines.)
Sorting by latitude or longitude doesn't always work either, since the line meanders back at times.
How do I construct a line from points based off of something like nearest point?