I would like to create a map of isolines for a given country.
I fetched road map using OSMNX:
cf = '["highway"~"motorway|motorway_link|trunk|primary|secondary"]'
G = ox.graph_from_place('Venezuela', network_type='drive', custom_filter=cf)
# project the graph to UTM
G_projected = ox.project_graph(G)
Then I created a subgraph of all nodes within given radius from starting point (lat, long):
node = ox.get_nearest_node(G, (8.284904228184445, -62.72239713960212))
subgraph = nx.ego_graph(G_projected, node, radius=10000, distance="length")
Resulting subgraph contains only 1 node (no matter what radius is used)
list(subgraph.nodes())
[5098062996]
List of neighbours is empty:
list(G_projected.neighbors(5098062996))
But for graph G (before projection was conducted):
list(G.neighbors(5098062996))
[5098062995]
The CRS of the starting point is EPSG:4326, WGS 84, project_graph projects it to UTM zone in which the graph’s centroid lies. But what is the resulting CRS, I guess that in this case, it is also WGS 84 because there is no difference in terms of geometry between results for G and G_projected. Is it necessary to project G to UTM each time, and what about the disconnected nodes, is it the result of projection operation?
Following methods turned out to be not very helpful in identifying the problem:
list(nx.isolates(G_projected))
list(nx.isolates(G))
Both return empty list. Which mean that every node has neighbours (is connected?)
Given node is also in the list of connected components of a graph:
5098062996 in list(nx.connected_components(G_projected.to_undirected()))[0]
True
We have contradicted information, the node is connected but has no neighbours and resulting subgraph contains only the starting point.
I have to emphasise that for different nodes everything work fine, I encountered issues only with that particular node. For G without projection it works. I only used the projection because I saw it in notebook examples at OSMNX github page.
I should simply do not use the projection or I should use it and there is some other issue with the graph connectivity?
Any advice would be appreciated.