dt = '2022-05-01'
j=292917
for i in tqdm(range(31)):
# 获取轨迹、揽件、派件数据
df_liushuai = df_33[df_33['gpsDate'] == dt]
# 获取liushuai当天的gps轨迹
df_liushuai = df_liushuai.sort_values(by='gps_time')
df_liushuai = df_liushuai.loc[:, ['lat_wgs', 'lon_wgs']].values
# 将轨迹添加到图中
m0 = folium.Map([df_33['lat_wgs'].mean(), df_33['lon_wgs'].mean()], zoom_start=30) # 中心区域的确定
groups = folium.FeatureGroup('momomomo')
df_liushuai = df_liushuai.tolist()
# 将product的轨迹打印出来
if df_liushuai != []:
for loc in df_liushuai:
folium.Circle(loc, radius=2, fill=True, color='red', fill_opacity=1).add_to(m0)
folium.PolyLine( # polyline方法为将坐标用实线形式连接起来
df_liushuai, # 将坐标点连接起来
weight=2, # 线的大小为4
color='red', # 线的颜色为红色
opacity=0.8, # 线的透明度
).add_to(m0) # 将这条线添加到刚才的区域m内
# dict_operator[j].append(dt)
for lonlats in boundary_all_wgs:
folium.PolyLine(locations=[[lat, lon] for lat,lon in lonlats], opacity=0.8, weight=3, color='orange').add_to(m0)
# 保存yangzhen当天的可视化结果
isExists=os.path.exists('heatmap/'+str(j))
if not isExists:
os.makedirs('heatmap/'+str(j))
#print(m0)
m0.save(os.path.join(r'heatmap',str(j), 'Heatmap{}.html'.format(dt),))
# m2.save(os.path.join(r'C:\Users\chenjinwei14\PycharmProjects\pythonProject\tra', 'Heatmap{}-wangdongming.html'.format(i)))
dt = datetime.datetime.strptime(dt, '%Y-%m-%d')
dt = dt + relativedelta(days=1)
dt = dt.strftime('%Y-%m-%d')