首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用'Polyline‘

如何使用'Polyline‘
EN

Stack Overflow用户
提问于 2020-02-04 16:44:28
回答 1查看 4.9K关注 0票数 0

使用jupyter Notebook/python3

我想使用带标记的折线,但它不起作用

代码语言:javascript
复制
map = folium.Map(location=[37.4601908, 126.4406957])

for index,lat in enumerate(place_lat):
    folium.Marker([lat, 
                   place_lng[index]],
                  popup=('patient3 \n 74contacts'),
                 icon = folium.Icon(color='green',icon='plus')).add_to(map)
    folium.Polyline(color='red').add_to(map)

map

我还以为Polyline在folium中

但错误显示

代码语言:javascript
复制
AttributeError: module 'folium' has no attribute 'Polyline'

如何使用多段线?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-02-04 17:23:22

docs中,您应该使用PolyLine

例如:

代码语言:javascript
复制
import folium

m = folium.Map(location=[37.4601908, 126.4406957],
               zoom_start=15)

place_lat = [37.4601928, 37.4593108, 37.4641108, 37.4611508]
place_lng = [126.4406957, 126.4432957, 126.4476917, 126.4423957]

points = []
for i in range(len(place_lat)):
    points.append([place_lat[i], place_lng[i]])

for index,lat in enumerate(place_lat):
    folium.Marker([lat, 
                   place_lng[index]],
                  popup=('patient{} \n 74contacts'.format(index)),
                 icon = folium.Icon(color='green',icon='plus')).add_to(m)
folium.PolyLine(points, color='red').add_to(m)

m

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60053573

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档