0

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?

Kris
  • 11
  • 1

1 Answers1

0

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']]
gboeing
  • 5,691
  • 2
  • 15
  • 41