检查存在哪些边缘属性(NetworkX)
Check which edge attributes exist (NetworkX)
我正在使用 OSMNX 将一个城市的 OpenStreetMap 文件加载到 NetworkX 中。我有什么办法可以查看图中存储了哪些属性?我相信 OSMNX 可能会存储街道的长度或道路的类型。我想知道我可以访问的属性名称是什么。
您可以显示边缘以查看其中的内容:
import osmnx as ox
G = ox.graph_from_place('Piedmont, California', network_type='drive')
print(G.edges(keys=True, data=True))
或者您可以使用 OSMnx convert the edges to a GeoDataFrame 并检查其列:
edge_attributes = ox.graph_to_gdfs(G, nodes=False).columns
print(edge_attributes)
最后,请注意,您可以通过将 useful_tags_way
或 useful_tags_node
参数传递给 ox.config().
来配置 OSMnx 附加到图节点和边的 OSM 属性
我正在使用 OSMNX 将一个城市的 OpenStreetMap 文件加载到 NetworkX 中。我有什么办法可以查看图中存储了哪些属性?我相信 OSMNX 可能会存储街道的长度或道路的类型。我想知道我可以访问的属性名称是什么。
您可以显示边缘以查看其中的内容:
import osmnx as ox
G = ox.graph_from_place('Piedmont, California', network_type='drive')
print(G.edges(keys=True, data=True))
或者您可以使用 OSMnx convert the edges to a GeoDataFrame 并检查其列:
edge_attributes = ox.graph_to_gdfs(G, nodes=False).columns
print(edge_attributes)
最后,请注意,您可以通过将 useful_tags_way
或 useful_tags_node
参数传递给 ox.config().