def get_nearest_point(kdtree, the_pt, dist_thresh_in_km=0.005):
    """
    Get the nearest point to "the_pt" using the the kd=tree index

    Arguments:
        kd {[KDTree]} -- The KD-tree of all the points
        the_pt {list} -- [x,y] of the point

    Keyword Arguments:
        dist_thresh_in_km {float} -- The maximum distance (in km) within
            which the nearest points have to be searched (default: {0.005})

    Returns:
        list -- A tuple of the nearest point in the tuple
            (distance, point index)
    """
    dist_in_km, ind = kdtree.query(the_pt, k=1)
    if dist_in_km is not None and dist_in_km <= dist_thresh_in_km:
        return dist_in_km, ind
    return None, None