I have a list of coordinates:
53.698831062,-1.6324645516
53.698318915,-1.6327240711
53.698139661,-1.6328105776
53.697345817,-1.6327240711
53.69744825,-1.6315562331
53.697064127,-1.6315562331
53.69685926,-1.6315562331
Into which I need to correctly insert another coordinate:
53.696859260432,-1.6315562330832
Assuming these coordinates together represent a route taken by a vehicle on a road, the correctly inserted position for the above coordinate would be where the vehicle would not have to turn around. That is, between which two points does this coordinate belong?
By plotting the points on the map, it is clear to see this coordinate would fit in the penultimate position in the list. What would be the programmatic way to calculate this, though?