【发布时间】:2020-09-16 15:12:42
【问题描述】:
我最近开发了一个程序,该程序从“Archinform”中获取特定城市的建筑作品数据,然后继续抓取所需的数据,然后绘制地图。 我一直在插入有关建筑物的信息作为工具提示,并将图像作为标记。 我怎样才能将建筑物名称添加到标记中? 我将在下面添加我的代码
arch_map = folium.Map(location=coord_città, zoom_start=11)
#creating map with folium with tooltips which are the information of the place and markers which are the images
for lat, lng,name,label in zip(valid_xcoords, valid_ycoords, google_names, project_info):
if lat != 0:
html = '<img src="data:image/jpeg;base64,{}">'.format
encoded = base64.b64encode(open(name+' '+cit+'.jpg', 'rb').read()).decode()
iframe = folium.IFrame(html(encoded), width=300, height=150)
tooltip = folium.Popup(iframe)
icon=folium.IFrame('<i class="fas fa-archway"></i>')
folium.Marker([lat, lng],tooltip=label,popup=tooltip,icon=folium.Icon(color='orange',icon='university',prefix='fa')).add_to(arch_map)
arch_map.save('Mappa di '+cit+'.html')
【问题讨论】: