route: move 2 more function out of the main html file

converToRadians
findClosest