Fixed production of incorrect paths

The previous implementation of the polyline algorithm produced incorrect paths due to using the wrong lat/lon as the base for the next loop cycle. This led to paths generated that when decoded did not match the data encoded (even within the 5 decimal place precision of the algorithm) after the second point.