Joining the distance associated to the routes to the source data (incidents)

1020
13
09-20-2018 05:02 PM
mcKinkade
New Contributor II

I have used the New Closest Facility function to calculate the distance between incidents (health cases) and facilities.  I have the routes with the distances but I need the distances joined back in the source data that created the incidents and can't find an easy way to do it.  I thought about doing a spatial join between the source data and the incidents, since the Location name isn't in the source layer, then using an attribute join using the location name and the route to bring in the distance.  Should work but seems clumsy so I thought there may be a better way.  

My real issue is that I have a data set of cases that have the facility where they went but I need to calculate the distance between each case and their respective facility.  I can't figure out how to do that in NA which seems odd.  ArcLogistics Route used to do it.  So what I have planned to do is select all of the cases that went to Facility A and load those selected features as incidents.  Then select the facility where they all went and load that selected facility in Facilities.  That gives me the route distance for all of the cases (incidents) to that specific facility but now I need that information back in the original layer.  Then I will have to repeat this procedure for each facility.  Anyone have a better way to do it?  This also is very clumsy so there must be a better way to do it.

Thanks,

Carl

0 Kudos
13 Replies
mcKinkade
New Contributor II

Thank you for the response.  I don't see how the Route method will work.  The New Route allows you to choose stops and routes versus incidents and facilities.  I don't see a method of choosing a "stop" from the attribute table in the cases to indicate that is the destination.  The stops could be the facilities so that aspect is correct but not the rest.  Unless I am missing something. 

As of right now, I only see the method that I am using which is:

- Use the OD matrix

- Select all cases that went to facility A in the "Origins" layer

- Select facility A in the "Destination" layer

- Run the OD matrix tool

   - Load the Selected Origins into the Origins Layer in the OD Cost Matrix (setting the Name field in the Location Analysis Properties section to "ID" of the Load Locations dialog so that I can tell which Origin is going to which Destination)

   - Load the Selected Destination into the Destination Layer in the OD Cost Matrix (setting the Name field in the Location Analysis Properties section to "Facility" of the Load Locations dialog so that I can tell which Destination is used)

 - Solve the OD Cost Analysis

- This result is a Line Layer showing the Distance between the Selected Cases (Origins) and Selected Facility (Destination).  Just to be clear the geometry on the screen is the straight line but the Total Length in the attribute table is network distance.

- I then export the lines into a layer stored in my geodatabase

- Create an attribute field called ID in the Lines layer

- Use the left function in the field calculator to extract out the ID only, since it has both the ID and facility in the same field

- Join the attribute Lines table back to my Cases Table by the ID field

- Use the field calculator to transfer the distance from the Lines layer into the Cases layer.

- Start over with the next facility (I guess that I could make a quick model to do this but I can probably do it manually just about as fast as perfecting the model). It is 14 facilities and about 1,000 cases so I need to do this 14 times. This doesn't count the ones that, for some reason, don't create routes.  I will deal with those after getting all the ones that will map.

I would be interested to hear about another method and just to recap, here is what I have and what I need:

- I have a disease case (home of a person with a certain disease) layer that has the case ID and the facility where they went, amongst other variables

- I have a facility layer with the facilities where they went.

What I need is the network (not straight line) distance between the home of the case and the facility but this distance needs to be## back in the case layer as an attribute for analysis.

0 Kudos
MelindaMorang
Esri Regular Contributor

As explained previously, use the RouteName field in the Stops sublayer in Route to control which route stops are along the same route.  The order in the table controls the order the stops are visited by the route.

Example Stops table:

OIDName

RouteName

1Case 1

Case 1 - Facility 1

2Facility 1

Case 1 - Facility 1

3Case 2

Case 2 - Facility 1

4Facility 1

Case 2 - Facility 1

5Case 3

Case 3 - Facility 12

6Facility 12

Case 3 - Facility 12

Example resulting Routes table:

OIDNameTotal_TravelTime
1Case 1 - Facility 125.5
2Case 2 - Facility 143.2
3Case 3 - Facility 1212.6
0 Kudos
mcKinkade
New Contributor II

Yeah. Interesting approach but the data that I have or any decent size

dataset this would not be fun to put together. Imagine doing that for

1,000 case records and 14 facilities. Also, I am looking at travel

distance, not time, but I understand that this is just an example. Thanks

for illustrating though.

0 Kudos
MelindaMorang
Esri Regular Contributor

Hello mcKinkate and anyone else reading this thread who might be doing similar workflows.

Esri’s Network Analyst Team is doing some research about customer workflows involving solving routes or calculating travel times and distances between known or preassigned pairs of origins and destinations.  It sounds like that's what you're doing here!  We’d like to better understand our customers’ needs in this area and may use this information to design and develop improved tools and workflows.

I know this thread is pretty old at this point, but if this workflow is still relevant to you and if you have a few minutes and are willing, could you please fill out the attached survey and return it to the e-mail address included inside the document?  Alternatively, you can reach out to me (my e-mail address is in the document) to set up a meeting.

Thank you so much!!

0 Kudos