OSMnx可视化Folium上边缘中心性的图形

时间:2018-03-29 00:01:04

标签: python matplotlib openstreetmap networkx osmnx

我试图使用以下代码在folium上绘制边缘中心图:

enter image description here Select tbl.* From myTable tbl Join ( Select item_code, max(price) as mx, Round(max(price)*.75,0) as mx75 From myTable Group by item_code) tab On tbl.item_code = tab.item_code And tbl.price between tab.mx75 and tab.mx Order by 1, 4

其中ec是边缘颜色列表但没有显示。 edge_color是否接受颜色列表?有什么想法吗?

如果你能帮助我,我真的很感激。

https://github.com/gboeing/osmnx-examples/blob/master/notebooks/08-example-line-graph.ipynb

1 个答案:

答案 0 :(得分:1)

我尝试将新的边缘颜色列添加到图形边缘的gdf

gdf_edges = ox.graph_to_gdfs(G, nodes=False, fill_edge_geometry=True) gdf_edges['edge_color'] = ec

然后修改两个功能

  

make_folium_polyline(edge,edge_width,edge_opacity,popup_attribute = None)

  

plot_graph_folium(gdf_edges,graph_map = None,popup_attribute = None,                         tiles =' cartodbpositron',zoom = 1,fit_bounds = True,                         edge_width = 5,edge_opacity = 1)

取得最终结果

enter image description here