code: def closest_point_to(self, point, thr=20.0):
          
          i = 0
          point_arr = point.gen2arr()
  
          def closest_in_line(pointA, pointB):
              temp = closest_point(pointA.gen2arr(), pointB.gen2arr(), point_arr)
              return Point(temp[1], temp[0], None)
  
          for (p_a, p_b) in pairwise(self.points):
              candidate = closest_in_line(p_a, p_b)
              if candidate.distance(point) <= thr:
                  if p_a.distance(point) <= thr:
                      return i, p_a
                  elif p_b.distance(point) <= thr:
                      return i + 1, p_b
                  else:
                      return i, candidate
              i = i + 1
          return -1, None
docs: Finds the closest point in the segment to a given point
  
          Args:
              point (:obj:`Point`)
              thr (float, optional): Distance threshold, in meters, to be considered
                  the same point. Defaults to 20.0
          Returns:
              (int, Point): Index of the point. -1 if doesn't exist. A point is given if it's along the segment