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.
I'm not sure if this answers the first half of your question, but for the second: You can accomplish this using the Route solver. What you need to do is to us the RouteName field in the Stops sublayer. When you have multiple RouteName values in the table, each one will be solved as an individual route. So, if Case 1 when to Facility A, load in Case 1 and Facility A as stops, and give them both the same RouteName (like 1-A). If Case 2 also went to Facility A, you would have to load in another copy of Facility A with a different RouteName (like 2-A).
Just to come back to this. So, in my case, where I have 14 facilities and 1,000 cases. I can't see how to make this work. I tried it by loading the stops from the cases by setting the route name as the facility and also loading the facilities as stops with the routename as the facility but it didn't work. It appears, from your description, that I would need to do this 1,000 times and loading each individually. Am I missing something?
You need two Stops for each case-facility pair, one for the case, and one for the facility. So, yes you will have many copies of the facilities in your input Stops, but you do not need 1000 copies of each. Each case went to one facility, so you will have 2000 total stops: 1000 for each case, and 1000 facilities, which will be multiple copies of the original 14, one copy per case.
Thanks. That still sounds like a lot more work than what I am doing.
Actually, I am done. I ran the OD 14 times and transferred the distances
to the cases. If there would have been more facilities, then my method
would have been very painful. It was painful enough. Of course, I would
have built a model to do it then but there still has to be an easier way to
solve the problem. This is very clumsy. Now I have to deal with the ones
that wouldn't create a route, which is a couple hundred. That is a whole
other process to figure out.
Thank you for the response. I will look at this. It also looks like the OD cost matrix may work. I don't need the actual routes, just the distances between the cases and the facilities so that I can analyze those distances and the impact on mortality. I tried the OD cost matrix before but since it drew straight lines between them, I thought that the distances were straight line distance and not network distance but I read an article today that said that it draws straight lines but stores network distance. If it does that, then I am set.
Even though the OD cost matrix solver doesn't output lines that follow the network, the values stored in the Lines attribute table reflect the network distance, not the straight-line distance.
Thank you. The first time that I ran it, it went from each case to all facilities so I will need to figure out why. My layer of cases have the facility as an attribute in the table so I need to figure out how to only give me the distance to their respective facility that they visited. I could do what I did with the Get Closest Facility tool and select all of the cases that went to one facility and then select that facility in the facility layer but I will play with it. I am sure this type of analysis has been done many times so I am surprised that there aren't more articles about it.
So, the OD Cost Matrix doesn't work for what I need. I ran it again and it does create a table of cases to facilities but it creates a table of all cases to all facilities. I don't see a way to tell it to use an attribute field to determine the destination. Also, it didn't create routes for some at all. It just gave a message that a route could not be determined even though they are snapped to the road network.
It did give a total-length attribute in the Lines table and I assume it is the network distance. I did a quick check by using the measuring tool and comparing the length of the some of the straight lines to the value in the Lines table and the numbers are different. The distance in the table is longer so it appears to work correctly.
I guess that I could select the cases by facility in the cases layer and then the facility that they went to in the facility layer and run it. Then it should only map those cases to their facility and then repeat for each facility. That may work but will be tedious. Surely there is a better way to do it. Also, there is still the challenge of getting the distance data back in the source cases layer since they assign Location names and not the ID from the cases. This seems like an oversight by the developers. You should be able to have an ID field from both origins and destinations travel with the data to the Line layer so that you know which ones that they mapping.
Yes, OD Cost Matrix reports network distance even though the geometry of the lines is straight. Just like Closest Facility, OD Cost Matrix does not have the ability to calculate the network distance between a specific origin and specific destination. It will report the distance from each origin to all destinations or the closest N destinations. If you want to calculate the distance from a specific origin to a specific destination, the Route method suggested above is the cleanest way to do it. Otherwise, you can load each origin one by one into OD or CF along with the specific destination it's supposed to go to, but that seems time consuming...