Reputation: 159
What is the best way to calculate the shortest street distance between two locations which cover a large distance using OSmnx. For example, if I was trying to find a route across the US?
Doing this seems burdensome, and perhaps impossible given my compute resources.
G = ox.graph_from_place('USA', network_type='drive')
orig_node = ox.get_nearest_node(G, (lat, lon))
dest_node = ox.get_nearest_node(G, (lat, lon))
nx.shortest_path_length(G, orig_node, dest_node, weight='length')
Any efficient methods to do this?
I did see this post..
python osmnx - extract only big freeways of a country
but even just the freeways in the US will create a huge network
Upvotes: 4
Views: 1816
Reputation: 6442
Given the enormity of your study site and the likely limitations of your computer, your best bet may be to first download an OSM extract then load it with OSMnx's graph_from_xml function.
Upvotes: 2