Distance measurements from point to point along a line feature class

4991
25
01-24-2015 09:29 PM
CoyPotts1
Occasional Contributor III

I am running ArcMap 10.2.2 on a Windows 7 machine.

 

I am wondering if it is possible to measure the distance from multiple points along a line feature class back to a single point.

 

Essentially I have a layer of points that are all routed back to a single location in another layer through a line feature class.  I would like a way to automate an output that gives me the measurement from each point back to the single point.  There are line segments that would need to be accounted for in the path for multiple points at times. 

 

The below image gives an example of the three feature classes that I have.  The one contains multiple points that are all routed back to a single "hub" location via a line feature class.  I need an output that measures the line distance back to that "hub" location from each individual point feature.

 

snip.JPG

0 Kudos
25 Replies
DanPatterson_Retired
MVP Esteemed Contributor

it is sort of like a Euclidean Minimum Spanning Tree, however, you already have the connection nodes and segments whether they represent the shortest path or not.  Do you have a copy of the data  that you could post? (a representative sample of the area)

XanderBakker
Esri Esteemed Contributor

... or use the Dijkstra algorithm (if you don't have Network Analyst): Finding the shortest route using Dijkstra's algorithm

CoyPotts1
Occasional Contributor III

Thanks to both of you for offering up suggestions.  I have never heard of either of these, and I have yet to be able to look into them or try them.  I just wanted to thank you for the assistance. 


I'll update further once I have played with them to see if either will work for our needs.

Thanks again!

0 Kudos
CoyPotts1
Occasional Contributor III

Okay, so I've had some time to review these suggestions and run some tests.  Here are my conclusions so far.

Dan:

I tried to run the Spanning Tree tool, but it gave me a really weird output.  I used a network with only a few points and I got a pretty spider web looking line output that didn't follow the paths of my line feature class.  Also, I'm not really sure if this tool would give me the output that I need.

Say you have three points (nodes feature class) along a linear path (fiber feature class) that all connect to a final point (hub feature class).  Let's just say that each segment of fiber connecting each node and to the hub is 1 mile in length and the nodes are numbered 1 through 3 starting with the one closest to the hub. I want an output that measures the length from each node back to the hub, as shown below:

Node 1: 1 Mile

Node 2: 2 Miles

Node 3: 3 Miles

Total:  6 Miles     (<--- this isn't necessary as I can do it in excel, just putting it here for a visual of what I want)

Unless I was simply inputting my parameters incorrectly, I don't think the spanning tree tool will give what I need. One thing that really leads me to believe that this isn't what I need is that there is no option to select the hub as the single point that all nodes are routed back to.  Please correct me if I am wrong.

My inputs were as follows:

Input points:  node feature class

Grouping Field:  field that contains node names (I wasn't real sure what to use here)

Output polyline:  just saved as a basic shapefile

Start node:  I left this blank

Xander:

Your suggestion actually seems promising from what I have read about it.  It appears that it is supposed to give an output that has the distance of each node back to a neutral point location based on the shortest distance, which will only be one option since there will only ever be one linking connection from each node back to the hub.  However, my limited knowledge and experience with running Python scripts has hindered my ability to run an adequate test case.  I loaded the python script into the python window and tried to run it, but I don't get anything as an output.  Just reading the code I can see that I am supposed to select a starting point (I guess I would select the hub) that each node will be measured back to, but I don't know how to do that.  I tried to simply grab the hub with my cursor, but I still didn't get an output when running the script.  I ended up learning how to add a script to a toolbox, so I added the script and ran it.  It doesn't give an option for any input parameters, and it gave the following error message "IndentationError: unexpected indent (recipe-119466-1.py, line 10)

Do you have any suggestions?

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

Spanning tree could be implemented to follow a network, currently it creates the minimum Euclidean distance between points not the network distance, ... so that is why I was asking for a sample of the vector data so I could use it for some testing without having to create my own.  But one of the options is the ability to specify root nodes.  So in short...in its current implementation it won't help much.  Network distance can also be done in the network analyst extension ($$) which is what Xander's algorithm implements without the $$

0 Kudos
XanderBakker
Esri Esteemed Contributor

Can you post a sample of your data? Dan Pattersonis willing to see if his Spanning tree code (which is brilliant by the way) can be used to solve your problem. I would also be willing to see if I can run the Dijkstra algorithm on your data. The error of the indentation on line 10 has to be due to a copy error of the code. Maybe you missed the first character of the code, something like this...

0 Kudos
CoyPotts1
Occasional Contributor III

I have a sample of all three feature classes, but I am unsure how to upload them here.  I don't see an option to do so through the reply window.

Thanks again for your help with this, guys.

0 Kudos
XanderBakker
Esri Esteemed Contributor

If you open the thread in a separated tab, you will see in the upper right part of the editor (when replying) the link "Advanced Editor". Click on that link and you will be redirected. In the advanced editor you will see a link in the lower right corner to Attach files.

CoyPotts1
Occasional Contributor III

Thanks for that, Xander.  I've gotten used to viewing the threads in the inbox view of the new website layout. 

0 Kudos