I have some GPS coordinates series taken in regular time steps and I need to verify whether some chunks of the trajectories fit well as a straight line or not. The aim is to perform segmentation on each trajectory, I am already able to find hard curves quite well, but the other segments are straight lines and smooth curves, I'd like to separate them based on a criterion of goodness of fit to a straight line.
The whole trajectories are not so big (usually not much bigger than 50 miles or kilometres) so spherical geometry corrections and haversine distances are not really required for this, but they would be interesting if simple.
I thought about fitting an $Y=aX+b$ model (longitude $X$, latitude $Y$) and looking at the $r^2$, but if a trajectory is nearly south to north I could have different results than the same trajectory rotated by 90 degrees since the values of $a$ and $b$ would be quite unstable.
Linearly fitting each coordinate versus time, hoping that if both fits well then I'd have a good fit may solve this issue, but I don't know if this is a valid approach nor if $r^2$ would be the best measure neither how to combine those $r_x^2$ and $r_y^2$.
Does anyone know a more appropriate way of verifying the goodness of fit of a straight line in such GPS series?