I have a GPS dataset that corresponds to a route taken by a vehicle in a day. It consist of a set of coordinates. Then say I have a coordinate and I want to know how close this coordinate is to this route. So basically I am calculating the distance to each point on the route and get the minimum value. But I have to do this many times. If route has n points and there are m coordinates whose distance to the route must be calculated then complexity is m*n. I was just wondering if there could be a smarter way to this this?