Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我构建了一个图表,想查看图表中每个节点的纬度和经度值。我怎样才能找到那些?
我曾经G.nodes找到每个节点,但我得到了某种 id。
G.nodes
import osmnx as ox G = ox.graph_from_point((41.0911561, 29.0151246), distance=500) print(G.nodes)
输出:(缩短)
[2394717187, 2394717190, 3445170185, ...
对于 id = 2394717187 的节点,使用以下代码获取它:
node0 = G.nodes(data=True)[2394717187]
然后,您可以打印它的long和lat:
long
lat
print( node0['x'], node0['y'] )
输出将是:- 29.0119616 41.0892429