我需要在传单地图中添加一些自定义标记图例。到目前为止,我找到的最接近的解决方案是this。根据链接中的解决方案,我需要使用addControl()
函数。
首先,我必须以html格式链接自定义图像。见下文:
html_legend <- "<img src='http://leafletjs.com/docs/images/leaf-green.png'
style='width:10px;height:10px;'>green<br/>
<img src='http://leafletjs.com/docs/images/leaf-red.png'
style='width:10px;height:10px;'>red"
然后我使用html_legend
作为addControl()
函数的参数:
addMarkers(...)%>%
addControl(html = html_legend, position = "bottomleft")
使用Awesome Icons时如何获得相同的结果?