gpt4 book ai didi

python - 叶画星标记

转载 作者:行者123 更新时间:2023-12-01 00:03:44 26 4
gpt4 key购买 nike

我正在考虑在大叶 map 上绘制三种不同的标记:方形、圆形和星形。前两个是使用 BeautifyIcon 插件完成的。我在绘制星星时遇到困难。我想只画星星而不画别针。有什么建议吗?

import folium

# Make an empty map
m = folium.Map(location=[15, 0], tiles="OpenStreetMap", zoom_start=2)

# square marker
icon_square = folium.plugins.BeautifyIcon(
icon_shape='rectangle-dot',
border_color='red',
border_width=10,
)
folium.Marker([50, -70], tooltip='square', icon=icon_square).add_to(m)

# circle marker
icon_circle = folium.plugins.BeautifyIcon(
icon_shape='circle-dot',
border_color='green',
border_width=10,
)
folium.Marker([-20, 25], tooltip='circle', icon=icon_circle).add_to(m)

# star marker
icon_star = folium.Icon(
prefix='fa',
icon='star',
icon_color='blue',
)
folium.Marker([60, 125], tooltip='star', icon=icon_star).add_to(m)


m.save('markers_on_folium_map.html')

最佳答案

正在处理BeautifyIcon options 可以满足您的需求:

import folium
from folium.plugins import BeautifyIcon

# Make an empty map
m = folium.Map(location=[15, 0], tiles="OpenStreetMap", zoom_start=2)

# square marker
icon_square = BeautifyIcon(
icon_shape='rectangle-dot',
border_color='red',
border_width=10,
)
folium.Marker([50, -70], tooltip='square', icon=icon_square).add_to(m)

# circle marker
icon_circle = BeautifyIcon(
icon_shape='circle-dot',
border_color='green',
border_width=10,
)
folium.Marker([-20, 25], tooltip='circle', icon=icon_circle).add_to(m)

# star marker
icon_star = BeautifyIcon(
icon='star',
inner_icon_style='color:blue;font-size:30px;',
background_color='transparent',
border_color='transparent',
)

folium.Marker([60, 125], tooltip='star', icon=icon_star).add_to(m)

m.save('markers_on_folium_map.html')

你会得到:

enter image description here

关于python - 叶画星标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60131314/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com