methods.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:kharita 作者: vipyoung 项目源码 文件源码
def load_data(fname='data/gps_data/gps_points.csv'):
    """
    Given a file that contains gps points, this method creates different data structures
    :param fname: the name of the input file, as generated by QMIC
    :return: data_points (list of gps positions with their metadata), raw_points (coordinates only),
    points_tree is the KDTree structure to enable searching the points space
    """
    data_points = list()
    raw_points = list()

    with open(fname, 'r') as f:
        f.readline()
        for line in f:
            if len(line) < 10:
                continue
            vehicule_id, timestamp, lat, lon, speed, angle = line.split(',')
            pt = GpsPoint(vehicule_id=vehicule_id, timestamp=timestamp, lat=lat, lon=lon, speed=speed,angle=angle)
            data_points.append(pt)
            raw_points.append(pt.get_coordinates())
    points_tree = cKDTree(raw_points)
    return np.array(data_points), np.array(raw_points), points_tree
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号