1

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"

or

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:

[![screenshot2][2]][2]

[1]: http://i.stack.imgur.com/mg1uF.jpg [2]: http://i.stack.imgur.com/XTl7y.png

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."

  • Can be done with Linear Referencing (Create Routes, Locate Features)+ Merge Events&Villages+ Points to Line – FelixIP Aug 20 '15 at 20:21
  • 2
    Sorry Shu Zhang, This forum really needs one specific question (per question) and lot's of background to what you want answered. We are all busy and this is not the place to learn everything about shortest path methods. Please edit your question to ask something specific and tell us what you have tried. – Brad Nesom Aug 20 '15 at 20:23
  • I used this video to learn about shortest path: youtube.com/watch?v=dO3Tf_AqEZA – Emil Brundage Aug 20 '15 at 21:55
  • Two problems here. The first is a simple Euclidean distance calculation where the point layer and the road layer are the inputs. – Chris Strother Aug 21 '15 at 16:42
  • @BradNesom Thank you for your advice about the post. I have updated with more details. – Shu Zhang Aug 29 '15 at 2:36
3

The first comment about merging points to lines will get you to the closest road, but this will not take into account the terrain cost (ie going through a forest or up a mountain may be a shorter distance but will take much longer than a longer distance but easier travelled clear route) To do this like the comment said it is simply a euclidian distance trig problem between your coordinate pairs (ie the start of road, where you merged your point to the nearest road, [x,y], and the center of village [a,b]) http://www.cut-the-knot.org/pythagoras/DistanceFormula.shtml

To solve the network part you will need to create a network dataset out of the roads. Once you have done this you will simply solve a closest facility problem. To do this you create your facility, which is your starting point. You then load your incidents, which is your end points (where you are travelling to, ie the port facilities) Then you solve the network problem. Your accumulation, which you will setup (it can be in miles, meters, whatever) that will be your total distance along the road.

This tutorial should help explain it - http://help.arcgis.com/en/arcgisdesktop/10.0/pdf/network-analyst-tutorial.pdf if you have other questions please ask.

  • Hi @user3338197, thanks for your answer. I found it useful and have solved the first part. If you got time, please help me look at the second part again. I have updated it in my question with more details. – Shu Zhang Aug 30 '15 at 4:08
1

To answer part two of this question, i didnt know if it was appropriate to edit my first answer or start another so mods if i am wrong please move to correct spot, anyways so once you have network analyst toolbar loaded you will create a closest facility problem. (refer to that tutorial i posted earlier for how to do that if you need) now your incident will be the village

If you want there to be a road from the village to the nearest road you will have to edit the road feature class and extend the road or make a new one and then you will have to re-create the network and use the new network feature class. If you do this your incident will actually be at the village you wish to start from.

Make sure to set your tolerances so it will find the nearest road say within a 300m or whatever incase your facility is not exactly on the road.

Once you have chosen your incident location you will choose your facilities which will be all of the sea ports. So drop a facility icon at the end of each road at the port. So you are looking at one incident (the village) and multiple facilities the sea ports.

You can change the analyst settings and set your accumulation in meters or km or whatever. You can set cost etc here aswell.

Then solve the network problem. This will only solve for one village at a time, you will have to create a new incident for each running of the program. Then open the attributes on the solved route in your table of contents and you will see a field showing your distance accumulation.

Here is a good tutorial https://www.youtube.com/watch?v=Sh6Nb_Yaigw

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.