【发布时间】:2020-06-17 22:12:18
【问题描述】:
例如,我正在尝试获取巴黎所有可行驶街道的长度。从文档中,我找到了这段代码来获取所有道路的面积,以平方米为单位。
我想要得到的是所有这些可行驶道路的长度,以米或公里为单位。我该怎么做?
# Get the network graph for drivable public streets (but not service roads)
G = ox.graph_from_place('Paris, France', network_type='drive') # for bikes the network_type would be 'bike'
fig, ax = ox.plot_graph(G, node_size=0, bgcolor='k')
# what sized area does our network cover in square meters?
G_proj = ox.project_graph(G)
nodes_proj = ox.graph_to_gdfs(G_proj, edges=False)
graph_area_m = nodes_proj.unary_union.convex_hull.area
graph_area_m
从文档中,基本统计显示:
# show some basic stats about the network
ox.basic_stats(G_proj, area=graph_area_m, clean_intersects=True, circuity_dist='euclidean')
# edge_length_total = sum of all edge lengths in the graph, in meters
# edge_length_avg = mean edge length in the graph, in meters
# street_length_total = sum of all edges in the undirected
# street_length_avg = mean edge length in the undirected
street_length_total 是我选择的网络中所有街道的长度吗?
【问题讨论】:
标签: python openstreetmap osmnx