Le 15 août 2021 à 19:09, Dmitriy Tarasov <dmitriy...@uconn.edu> a écrit :
--
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/bc694ff6-10e7-4784-9f02-3a1fdee8be2bn%40googlegroups.com.
Le 27 juill. 2021 à 12:07, Dmitriy Tarasov <dmitriy...@uconn.edu> a écrit :
My Python is rusty and I'm a complete newcomer to Networkx, so sorry for such an obvious question. I have two sets of points -- let's call them Origins and Destinations --and an undirected graph. For every Origin, I need to find the nearest Destination and calculate the shortest path to it, saving all shortest paths to the same file. Am I right that I will first need to find the node on a graph that's closest to the Origin and calculate the path to a node nearest to a Destination?
Is Dijkstra's algorithm what I should use, or are there other algorithms in Networkx that are better for this?
--
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/a31261eb-a2cb-45b8-a525-c16c4d321aa9n%40googlegroups.com.
Le 1 août 2021 à 15:37, Dmitriy Tarasov <dmitriy...@uconn.edu> a écrit :
The number of origins and destination points is usually in the double digits (the biggest dataset that I've seen so far is, I think, between 600 and 700 points). As for the graphs, there are, I guess, a couple of thousand nodes and edges (the graphs represent networks of roads in rural counties, my plan is to download them from OpenStreetMap using OSMnx). So, I think that the origins and destinations should all be part of the same connected component. What I'm trying to do here is similar to the Closest Facility solver in ArcGIS, with distance as the cost and a GeoDataFrame of the shortest paths (which I'll write to a shapefile or feature class) as the output.
--
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/d8bf0ab2-f477-4e57-87c7-47507f052ef5n%40googlegroups.com.
Le 17 août 2021 à 13:53, Dmitriy Tarasov <dmitriy...@uconn.edu> a écrit :
I am trying to find an alternative to the Closest Facility solver in ArcGIS (my current version of ArcGIS does not include it). I know that Networkx cannot draw routes between facilities and incidents, but only between the nodes that are closest to them, so I'll need to find such nodes. My incidents I read from a shapefile using GeoPandas:
import osmnx as oximport geopandas as gpdincidents_fp = "C:/Users/User Name/fakepath/incidents.shpincidents = gpd.read_file(incidents_fp) # Reading incidents from a shapefile. Am I right that this creates a GeoDataFrame?Next, for every incident, I try to find the nearest node on a graph and to append that node to a GeoDataFrame that will be used for finding the shortest paths. This is where I get an error:
incident_nodes = gpd.GeoDataFrame(columns=["geometry"], crs="EPSG:2235") # creates an empty GeoDataFrame to hold the nodesfor incident in incidents:node_near_incident = ox.distance.nearest_nodes(graph_proj, incident.geometry.x, incident.geometry.y, return_dist=False)What could be causing this error? The incidents do have a column named geometry. This is what they look like when printed:
<Incidents_printed.JPG>
To view this discussion on the web visit https://groups.google.com/d/msgid/networkx-discuss/f8c3133c-6557-4366-89c2-19cf9d14f912n%40googlegroups.com.
<Incidents_printed.JPG>