TransWikia.com

Issue with creating sub graphs from Los Angeles County graph

Geographic Information Systems Asked by Rahul Agnihotri on July 30, 2021

I am trying to extract a subgraph using networkx ego_graph function from Los Angeles County graph.
When i plot this graph and compare it with graph generated from graph_from_point (which looks correct), they seem to be completely different.

Here is my code

G = ox.graph_from_place('Los Angeles County, California, USA')

node = ox.get_nearest_node(G, (34.6806, -118.1435))

Subgraph from networkx

sub_graph = nx.ego_graph(G, node, radius=2500, distance='length')

ox.plot_graph(sub_graph)

enter image description here

graph_from_point

g = ox.graph_from_point((34.6806, -118.1435), dist = 2500)
ox.plot_graph(g)

enter image description here

Both sub_graph and g look completely different.
Am i doing anything wrong here?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP