transform used to calculate polyline distance was leaving the polyline coordinates in meters (I think). Added a reverse transform, which is probably not the most efficient way to do it, but seems work.