【发布时间】:2020-08-09 00:36:08
【问题描述】:
参考OSMnx Get Lat Lon Coordinates of Clean Intersection Nodes 最近从 clean_intersections 更改为 consolidate_intersections,原始链接中的 sn-ps 似乎不起作用。我们现在如何使用 consoilidate_intersections 获得相同的 XY 坐标和纬度?
【问题讨论】:
标签: osmnx
参考OSMnx Get Lat Lon Coordinates of Clean Intersection Nodes 最近从 clean_intersections 更改为 consolidate_intersections,原始链接中的 sn-ps 似乎不起作用。我们现在如何使用 consoilidate_intersections 获得相同的 XY 坐标和纬度?
【问题讨论】:
标签: osmnx
如果您提供 rebuild_graph=True 与 False 作为 consolidate_intersections 参数化,这将有所不同。见the docs。我假设您的意思是默认参数化。只需将您的图表转储到 GeoDataFrame,然后 x、y、lat 和 lon 就会出现在列中:
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']]
【讨论】: