Getting XY Coordinates/Lat Lon from OSMNX Consolidate Intersections

岁酱吖の 提交于 2021-01-29 15:40:17

问题


With reference to OSMnx Get Lat Lon Coordinates of Clean Intersection Nodes and the recent change from clean_intersections to consolidate_intersections, the snippets in the original link do not appear to work.how can we get the same XY coorindates and Lat Lon now with consoilidate_intersections?


回答1:


This will vary if you provide rebuild_graph=True vs False as the consolidate_intersections parameterization. See the docs. I'll assume you mean the default parameterization. Just dump your graph to a GeoDataFrame then x, y, lat, and lon will be in the columns:

import osmnx as ox
ox.config(use_cache=True, log_console=True)
G = ox.graph_from_place('Piedmont, CA, USA', network_type='drive')
Gc = ox.consolidate_intersections(ox.project_graph(G))
nodes = ox.graph_to_gdfs(Gc, edges=False)
nodes[['x', 'y', 'lat', 'lon']]


来源:https://stackoverflow.com/questions/63310747/getting-xy-coordinates-lat-lon-from-osmnx-consolidate-intersections

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!