0

我正在尝试绘制一个封闭的轮廓并用(透明或其他)颜色填充它folium。缺少的文档没有帮助,任何想法如何做到这一点?

这是我当前的代码

m = folium.Map(location=[46, 2], zoom_start=5)

pts = [
[43.601795137863135, 1.451673278566412],
[43.61095574264419, 1.437239509310642],
[43.60999839038903, 1.45630473303456],
[43.60607351937904, 1.438762676051137],
[43.59725521090158, 1.444569790831369],
[43.6076281683173, 1.451991362348086]
]

p = folium.PolyLine(locations=pts,weight=5)
m.add_children(p)
4

2 回答 2

1

这没有记录(没有真正记录的 ATM),但这有效

m = folium.Map(location=[46, 2], zoom_start=5)

pts = [
[43.601795137863135, 1.451673278566412],
[43.61095574264419, 1.437239509310642],
[43.60999839038903, 1.45630473303456],
[43.60607351937904, 1.438762676051137],
[43.59725521090158, 1.444569790831369],
[43.6076281683173, 1.451991362348086]
]

folium.features.PolygonMarker(locations=pts, color='#FF0000', fill_color='blue', weight=5).add_to(m)
于 2016-10-18T16:13:01.900 回答
0

要添加到 Overdrivr 的代码中,您还可以首先制作点的凸包以确定点覆盖的区域。

from scipy.spatial import ConvexHull
import folium

m = folium.Map(location=[43.6, 1.43], zoom_start=13)

pts = [
[43.601795137863135, 1.451673278566412],
[43.61095574264419, 1.437239509310642],
[43.60999839038903, 1.45630473303456],
[43.60607351937904, 1.438762676051137],
[43.59725521090158, 1.444569790831369],
[43.6076281683173, 1.451991362348086]
]

b = [pts[i] for i in ConvexHull(pts).vertices]

folium.features.PolygonMarker(locations=b, color='#FF0000', fill_color='blue', weight=5).add_to(m)
于 2018-07-18T07:55:46.120 回答