I have a shapefile of points (which I have written to a GeoDataFrame), and for each point, I need to find the nearest node on a graph and add an edge from that node to my point. I was thinking of doing this as follows:
for index, row in subscribers.iterrows(): # Let’s call my points GeoDataFrame “subscribers”
subscr_location = (row[“Latitude”], row[“Longitude”])
subscr_node_id = osmnx.get_nearest_node(graph_proj, subscr_location, method=”euclidean”) # graph_proj is the name of my graph
subscr_node = nodes_proj.loc[subscr_node_id]
graph_proj.add_node(subscr_location)
graph_proj.add_edge(subscr_node, subscr_location)
--
You received this message because you are subscribed to the Google Groups "networkx-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to networkx-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/networkx-discuss/520662a4-df80-408e-8c5e-e44cb9b0930cn%40googlegroups.com.