Пример #1
0
def probe_to_link_dist(link_points, probe):
    link_points_rad = np.deg2rad(link_points)
    probe_rad = np.deg2rad(probe)

    #底边
    base_side = haversine_np(link_points_rad[:-1,:], link_points_rad[1:,:])
    #腰
    tmp = haversine_np(probe_rad, link_points_rad)
    side1 = tmp[:-1]
    side2 = tmp[1:]

    link_dis = calc_link_dis(base_side, side1, side2)
    return np.min(link_dis)
Пример #2
0
def calc_road_vec(probe, link_points):
    link_points_rad = np.deg2rad(link_points)
    probe_rad = np.deg2rad(probe)

    base_side = haversine_np(link_points_rad[:-1,:], link_points_rad[1:,:])
    tmp = haversine_np(probe_rad, link_points_rad)
    side1 = tmp[:-1]
    side2 = tmp[1:]

    link_dis = calc_link_dis(base_side, side1, side2)
    min_idx = np.argmin(link_dis)
    road_vec = np.array(link_points[min_idx + 1]) - np.array(link_points[min_idx])
    return road_vec
Пример #3
0
def probe_to_link_dist(link_points, probe):
    link_points_rad = np.deg2rad(link_points)
    probe_rad = np.deg2rad(probe)

    #底边
    base_side = haversine_np(link_points_rad[:-1, :], link_points_rad[1:, :])
    #腰
    tmp = haversine_np(probe_rad, link_points_rad)
    side1 = tmp[:-1]
    side2 = tmp[1:]

    link_dis = calc_link_dis(base_side, side1, side2)
    return np.min(link_dis)
Пример #4
0
def calc_road_vec(probe, link_points):
    link_points_rad = np.deg2rad(link_points)
    probe_rad = np.deg2rad(probe)

    base_side = haversine_np(link_points_rad[:-1, :], link_points_rad[1:, :])
    tmp = haversine_np(probe_rad, link_points_rad)
    side1 = tmp[:-1]
    side2 = tmp[1:]

    link_dis = calc_link_dis(base_side, side1, side2)
    min_idx = np.argmin(link_dis)
    road_vec = np.array(link_points[min_idx + 1]) - np.array(
        link_points[min_idx])
    return road_vec
Пример #5
0
def dis_ref_nonref(probe, link_points, nearest_dis, link_len):
    link_points_rad = np.deg2rad(link_points)
    probe_rad = np.deg2rad(probe)

    base_side = haversine_np(link_points_rad[:-1, :], link_points_rad[1:, :])
    tmp = haversine_np(probe_rad, link_points_rad)
    side1 = tmp[:-1]
    side2 = tmp[1:]

    link_dis = calc_link_dis(base_side, side1, side2)
    min_idx = np.argmin(link_dis)
    proj_len = calc_proj_len(base_side[min_idx], side1[min_idx], side2[min_idx])
    dis_ref = np.sum(base_side[:min_idx]) + proj_len
    dis_ref = dis_ref / np.sum(base_side) * link_len
    dis_nonref = link_len - dis_ref
    return dis_ref, dis_nonref
Пример #6
0
def dis_ref_nonref(probe, link_points, nearest_dis, link_len):
    link_points_rad = np.deg2rad(link_points)
    probe_rad = np.deg2rad(probe)

    base_side = haversine_np(link_points_rad[:-1,:], link_points_rad[1:,:])
    tmp = haversine_np(probe_rad, link_points_rad)
    side1 = tmp[:-1]
    side2 = tmp[1:]

    link_dis = calc_link_dis(base_side, side1, side2)
    min_idx = np.argmin(link_dis)
    proj_len = calc_proj_len(base_side[min_idx], side1[min_idx], side2[min_idx])
    dis_ref = np.sum(base_side[:min_idx]) + proj_len
    dis_ref = dis_ref / np.sum(base_side) * link_len
    dis_nonref = link_len - dis_ref
    return dis_ref, dis_nonref