【发布时间】:2021-04-23 13:01:26
【问题描述】:
为我的最后一年项目制作程序。 程序从 .csv 数据集中获取经度和纬度坐标,并将它们绘制在地图上。 我遇到的问题是有多个 ID,总共 445,000+ 点。
我将如何改进它以便程序可以区分 ID?
def create_image(self, color, width=2):
# Creates an image that contains the Map and the GPS record
# color = color the GPS line is
# width = width of the GPS line
data = pd.read_csv(self.data_path, header=0)
# sep will separate the latitude from the longitude
data.info()
self.result_image = Image.open(self.map_path, 'r')
img_points = []
gps_data = tuple(zip(data['latitude'].values, data['longitude'].values))
for d in gps_data:
x1, y1 = self.scale_to_img(d, (self.result_image.size[0], self.result_image.size[1]))
img_points.append((x1, y1))
draw = ImageDraw.Draw(self.result_image)
draw.line(img_points, fill=color, width=width)
我还附上了github project here,该程序可以运行,但我只是想尽量减少它一次绘制的用户数。
提前致谢。
【问题讨论】:
-
您能否从您的数据框中提供一个 sn-p。 ID 是其中的一部分吗?
-
这个问题和
tkinter有关系吗?我看不到任何与tkinter相关的代码 -
@TheLizzard 抱歉,是的,GUI 正在使用 TKinter,主要执行命令来自 tkinter。
-
@PonyTale 与 .csv 文件中的一样吗?由于ID被称为iPhoneUID。我还没有实现它,因为我不确定如何解决这个问题。我会将数据集添加到 GitHub
-
@JagerScouser 你认为一个人需要知道如何使用
tkinter来解决你的问题吗?据我所知,这个问题可以在几乎不了解 tkinter 的情况下解决。如果我是正确的,请删除tkinter标签