In my project, I need to calculate each village's distance along a route to a seaport.
However, as you can see in the picture(now deleted for space), not all the villages are connected to roads already, so, first of all, I want to ask how to create the shortest path from each village to the road. Since there are more than 400 such villages, I'm looking for an automatic way to do this job.
My second question is how to finding the shortest path and distance base on the network. I'm looking for an automatic way like running certain python functions to do this too.
I have done the first one by using the "Near" tool in "Analysis" and the "XY to Line." "Near" generates the closest coordinates on the road and "XY to Line" can draw lines from villages to the nearest coordinates.
I'm still frustrated by the second part.
I have tried to use the way suggested by user3338197 in the first answer. I merged existing roads and the roads I created into one shapefile and built a network based on that and remained the default setting unchanged (I'm using 10.3). However, it always shows
Warning: No "Destinations" found for "Location 1" in "Origins"
Warning: No "Facilities" found for "Location 1" in "Incidents"
I tried to figure out what is the problem, so I ran a "New Route" problem, and I got a result like this:
As you can see, the first and the second location are connected by roads, but the network analysis failed to generate a route between them. The most important thing I'm trying to get is the distance from each village to the port.
Hope someone can help me fix this problem.
In the end, it's because some junctions are not connected as they seems to be. Solved by "Integrate."