"""
    火星坐标系(GCJ-02)转百度坐标系(BD-09)
    谷歌、高德——>百度
    :param lng:火星坐标经度
    :param lat:火星坐标纬度
    :return: bd_lng, bd_lat
    """
    x_pi = 3.14159265358979324 * 3000.0 / 180.0
    z = math.sqrt(lng * lng + lat * lat) + 0.00002 * math.sin(lat * x_pi)
    theta = math.atan2(lat, lng) + 0.000003 * math.cos(lng * x_pi)
    bd_lng = z * math.cos(theta) + 0.0065
    bd_lat = z * math.sin(theta) + 0.006
    return bd_lng, bd_lat


if __name__ == '__main__':
    df = load_data_of(columns=['order_id', 'departure_time'])
    day_list, count_list, hourcount_list = count_of_days(df)
    

    result_dict = {}
    result_dict['day_count'] = {}
    result_dict['hour_count'] = {}
    for a, b, c in zip(day_list, count_list, hourcount_list):
        print(a, b, c)
        result_dict['day_count'][a] = b
        result_dict['hour_count'][a] = c

    result_df = pd.DataFrame(result_dict)
    result_df.to_csv("data_dayly_hourly_count.csv")
    print("load data done")

        c.add_control_panel(navigation_control_opts=opts.BMapNavigationControlOpts(offset_height=30),
                            scale_control_opts=opts.BMapScaleControlOpts(),)
        return c

    #可视化
    geo = bmap_linemap()
    geo.render( 'line_bmap.html')


if __name__ == '__main__':
    data_file = "D:/CCF2019/data/selected_data/" + "DAY_WEEKDAY_0920" + ".csv"  # 选择数据======================
    date_imterval = ['2017-09-20', '2017-09-20']  #  选择时间===========================
    time_interval = [0, 24]  #  选择时间===========================

    df = load_data_of(file=data_file,
                      dates=date_imterval, time_interval=time_interval,
                      columns=['order_id', 'departure_time', 'arrive_time', 'dest_lng', 'dest_lat', 'starting_lng', 'starting_lat','normal_time'])
    # print(df)
    print(df.shape)

    df = get_datda_near(df, position='海口美兰机场', key='ARRIVE')
    print(df.shape)

    index_lngLat, route_pair = get_lng_lat_route(df)
    # print(index_lngLat)
    # print(route_pair)
    index_value = make_value(index_lngLat)
    # print(index_value)
    draw_linemap(index_lngLat, index_value, route_pair)
Ejemplo n.º 3
0
    elif '公司' in ss:
        return '公司'
    elif '购物' in ss or '餐饮' in ss or '生活' in ss:
        return '休闲娱乐'
    else:
        return '其他'


if __name__ == '__main__':
    data_file = "D:/CCF2019/data/selected_data/" + "DAY_WEEKDAY_0920" + ".csv"  # 选择数据======================
    date_imterval = ['2017-09-20',
                     '2017-09-20']  #  选择时间===========================

    df = load_data_of(file=data_file,
                      columns=[
                          'order_id', 'departure_time', 'arrive_time',
                          'dest_lng', 'dest_lat', 'starting_lng',
                          'starting_lat', 'normal_time'
                      ])
    print("df total data:")
    print(df.shape)
    print(df.columns)

    poi_counter_24 = []
    for i in range(24):
        time_interval = [i, i + 1]  #  选择时间===========================
        sub_df = select_df_of(df,
                              dates=date_imterval,
                              time_interval=time_interval)

        sub_df['dest_near_poi'] = sub_df.apply(lambda row: find_near_poi(
            (row['dest_lng'], row['dest_lat'])),