0

I constructed a graph and want to see the latitude and longitude values of each node in the graph. How can I find those?

I used G.nodes to find each node but I get some sort of ids.

import osmnx as ox

G = ox.graph_from_point((41.0911561, 29.0151246), distance=500)
print(G.nodes)

output : (shortened)

[2394717187, 2394717190, 3445170185, ...
Nora_F
  • 431
  • 5
  • 17

1 Answers1

1

For a node with id = 2394717187, get it with this code:

node0 = G.nodes(data=True)[2394717187]

then, you can print its long and lat with:

print( node0['x'], node0['y'] )

The output will be:- 29.0119616 41.0892429

swatchai
  • 17,400
  • 3
  • 39
  • 58