OSMNx : get coordinates of nodes using OSM id

前端 未结 3 2105
遥遥无期
遥遥无期 2020-12-16 03:03

I used the Python library OSMNx to draw an optimal route between several steps of a city trip. The final variable is a list of OSM ids.

Now, I\'m trying to save this

3条回答
  •  死守一世寂寞
    2020-12-16 03:40

    See also this on GitHub for more details:

    The x and y attributes are your node coordinates. If your graph is unprojected, then they are in lat-lon (degree units).

    If you've projected your graph, then x and y are your projected node coordinates (in meters or whatever units your projected coordinate system uses) and the nodes will also have additional lat and lon attributes that contain the original unprojected coordinates.

    import osmnx as ox
    G = ox.graph_from_place('Piedmont, CA, USA', network_type='drive')
    node_id = list(G.nodes())[0]
    G.node[node_id]['x'] #lon
    G.node[node_id]['y'] #lat
    

提交回复
热议问题