检查存在哪些边缘属性(NetworkX) [英] Check which edge attributes exist (NetworkX)

查看:256
本文介绍了检查存在哪些边缘属性(NetworkX)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用OSMNX将城市的OpenStreetMap文件加载到NetworkX中.我有什么办法可以查看图中存储了哪些属性?我相信OSMNX可以例如存储一条街道的长度或道路的类型.我想知道可以访问的属性名称.

I'm using OSMNX to load an OpenStreetMap file of a city into NetworkX. Is there any way for me to see which attributes are stored in the graph? I believe OSMNX might for instance store the length of a street, or the type of road. I want to know what the names of the attributes are that I can access.

推荐答案

您可以显示边缘以查看其中的内容:

You could either display the edges to see what's in them:

import osmnx as ox
G = ox.graph_from_place('Piedmont, California', network_type='drive')
print(G.edges(keys=True, data=True))

或者您可以使用OSMnx 将边缘转换为GeoDataFrame 并检查其列:

Or you could use OSMnx to convert the edges to a GeoDataFrame and inspect its columns:

edge_attributes = ox.graph_to_gdfs(G, nodes=False).columns
print(edge_attributes)

这篇关于检查存在哪些边缘属性(NetworkX)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆