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
评论列表
文章目录