I want to produce a dataset that displays routes from firms to customs. Specifically, I want the dataset to display which states of the USA the route passes through and the lenght of the road for each state. I have tried the OD Cost Matrix, but it does not give details about the routes. I am currently using the Closest Facility analysis but when I load the locations for Facilities and Incidents, I lose a lot of attributes from the original data, such as the number of the state (state unique identifier). This identifier is crucial because after producing the dataset I will use it to do some analysis in Stata, but loading incidents and facilities is automatically losing a lot of attributes. Any recommendations on how to keep all attributes?
I see in my route table that there are Indident and Fcility identifiers, but how could I know for all the data which is which? I mean, I have a lot of records and seeing "Facility 2" means nothing. I want to know which state is each location in and so on.
Thank you very much for your help!
When you load data into the incident and facility layers it is possible to make the name follow an attribute in the data. This would allow you to see what "Facility 2" actually is.
Regarding the state data analysis I need a little more information. Are you saying you're losing attribute data when you bring it into Strata? Without understanding all of your workflow I would say you could export your route analysis as a new layer and then identify using the state layer. You could then summarize the length of the route that passes through each state. If you can describe the issue a little more I can try to get you more specifics.
First, thank you very much for your help.
Sorry if my question was a little vague. My Incident/Facilty locations come from two layers. Both of the layers have a unique identifier for state and county. When I right click on "Facilities" on the table of contents to load the layer, the locations appear in the map wihtout trouble. However, when I open the attribute table for facilities, I don't see anymore the state and county unique identifiers. This problem is completely regardless Stata.
What I want is to keep these identifiers so that later in Stata I can use them to produce different kind of analysis. But since I have thousands of routes, this obviously cannot be a mannual task. I want to automatically produce a route table that contains those identifiers. In the end, let's suppose that the variables or attributes in the final table I want are the following:
Origin ID / Origin name / Destination ID / Destination name / Total route lenght / State-1 / Lenght of road in State -1 / ......... / State-n / Lenght of road in State n.
So, in words, I want the entire distance from origin to destination, but I also want to know all the States the route goes across and the lenght of the route for each particular state.
I'm away from the data right now but I'll post back tomorrow. I had a lot more luck with my analysis once I added the name attribute when I was loading data.
Do you want the distance to be able to be seen or just have the distance in the attributes. The OD Cost matrix and closest facility analysis are similar but the main differences are in performance time (OD is faster for large matrices) and in returning the true shape (OD does not, closest facility does). So depending on your goals you may want to look at closest facility.
Regardless you can have access to the attributes you need in either analysis. If you look at your data I expect you will find that the numbers in Origin ID correspond to the object ids of the data loaded into the origin and the numbers in Destination ID similarly correspond to the OID's of the destination data. There should also be a name field that has (Origin ID - Destination ID) and if you didn't specify a name field when you loaded the data it will just be the object ids ( 1-2, 2-1, etc.) But if you add a name attribute when you load data it will show you the names rather than OIDs (Minnesota-California, California-Minnesota, etc).
I've attached a screenshot of an analysis setup I did with the name field populated and the resulting attribute table.
Let me know if I can be of more help.
Also meant to include this link to the documentation. They do a great job of explaining the differences and they have pictures. Very helpful.
Thanks once again.
I actually have been able to keep all attributes wanted in my tables so this is no longer a problem.
Now I have the data on the entire routes, but I lack the data on which states my route goes through. Do you know which tool works for this?
If you export out the routes as a feature class or shapefile you can perform an identify. This will take the attributes from the states layer and add it to the sections of your routes that fall within the states boundary. You can then summarize the data how you would like to.
Whenever you load locations into a Network Analysis layer, you can use the field mapping control to transfer attributes from the input feature class to the NA layer's Stops/Facilities/Origins/Destinations/etc. The input class in the NA layer doesn't automatically inherit all the fields from the input data. If you have an ID field, you could map that to the Name property in the NA layer. Or, before loading your input data, you could use the Add Field to Analysis Layer tool to add a custom field to the NA sublayer, and then you could map the field in your input to the custom field. Suppose your feature class of firms has a field called firmID and you want your Facilities sublayer in your Closest Facility layer to also have this field. You would have to add the field to the Facilities sublayer with the Add Field to Analysis Layer tool and then map the fields during the Load Locations process.
See this page for more details: ArcGIS Help (10.2, 10.2.1, and 10.2.2)
For your analysis, is each firm matched to a specific customer or set of customers, or are you actually trying to find the "closest facility" to each one? If you already know which pairs go together, and these pairs aren't necessarily the closest, you should use the Route tool rather than Closest Facility. There's a way you can use field mapping with the RouteName field to specify which pairs of points should be on the same route which I can describe in further detail if this is what you're trying to do.
As far as splitting the resulting routes by state to find out the distance traveled in each state, check out this video of a presentation from the Esri User Conference which contains a demo of exactly this problem: Network Analyst: Performing Network Analysis | Esri Video It starts around 13:00. The material prior to that in the video explains a bit about field mapping.
Thank you very much for your response.
I have been able now to add the attributes I want, so this is no longer a problem.
For my analysis, I want to connect ALL my firms to ALL my customs. I want to build this dataset because I am researching about exports, so I want to know all routes detailed. So let's say I have about 120 customs and about 2500 firms. In the end, this will result in 120*2500=300,000 routes. So this is what I want specifically. I guess your second suggest will work. I am looking right now at the video.
Thank you again! Further recommendations are welcome.