Select to view content in your preferred language

calculating driving distances

25200
25
05-19-2011 10:21 AM
DANIELWEBSTER
New Contributor
hello,

i am new to arcgis and am trying to calculate the driving distances between 2 sets of xy coordinates.

i have a data set with 5 columns--id, x-origin, y-origin, x-destination, y-destination--and would like to create a new showing the driving distance between the respective xy coordinates.

i was told that this might be possible using network analyst but have never worked with that tool.

any help would be appreciated!

Daniel
Tags (2)
0 Kudos
25 Replies
RamB
by
Frequent Contributor
Hi,

Yes this is very easy, there is also a tutorial with installation and also in the help file. Look here
http://www.esri.com/flashmedia/na_drivedirect.swf

If you dont find the files, let me know. I will explain further.

Sriram

hello,

i am new to arcgis and am trying to calculate the driving distances between 2 sets of xy coordinates.

i have a data set with 5 columns--id, x-origin, y-origin, x-destination, y-destination--and would like to create a new showing the driving distance between the respective xy coordinates.

i was told that this might be possible using network analyst but have never worked with that tool.

any help would be appreciated!

Daniel
0 Kudos
RobertGarrity
Esri Contributor
If I understand your objective correctly, you want to find the driving distance from one specific origin to one specific destination, not from all origins to all destinations. This is important because, at first glance, you might think the OD cost matrix solver would work best, but actually it's probably best to do the following using a route layer instead:

1. On your dataset, create a new field named RouteName and calculate its value so that it is the same value as your current ID field.
2. Add your origins to ArcMap as a layer. (Tip: File > Add Data > Add XY Data.) Only specify the origin X and Y fields.
3. Rename the output layer that appears in the table of contents to something like Origins.
4. Add your destinations to ArcMap as a layer. Only specify the destination X and Y fields.
5. Rename the output layer to Destinations.
6. Make a Route layer using the Network Analyst toolbar (or a GP tool).
7. Load the Origins layer into the Stops class. (Tip: Right-click Stops in the Network Analyst window and choose Load Locations.) Make sure the RouteName field is mapped to the RouteName field you created.
8. Load the Destinations layer into the Stops class using the same method.
9. Solve

By specifying the route name when loading, the stops are grouped together and routes are calculated only for the stops that are in the same group, which in your case is limited to a single origin and destination pair.

You can open, and optionally export, the Routes class, which contains the calculated shortest-path driving distances. The Name field values will match the values of your original IDs.
0 Kudos
SWETABYAHUT
Emerging Contributor
Hi all, I have a similar query. I need to calculate the shortest network distance (driving distance) between a set of Origins and a set of destinations from a travel survey. I need to also built in constraints like one-way, no U-turns except on dead ends, speed limits, etc. Please let me know how this can be done. I have more than 10,000 trips for which I need to calculate driving distances. This is part of my dissertation research. 

Any help and tips would be appreciated!

Thanks, Sweta Byahut
0 Kudos
JoeBorgione
MVP Emeritus
All this can be done with network analyst, but you'll need to take some time to learn how to use the extension.  There is an ESRI tutorial available and you can search the on line help for specific information.
That should just about do it....
0 Kudos
XiaominRuan
Emerging Contributor
If I understand your objective correctly, you want to find the driving distance from one specific origin to one specific destination, not from all origins to all destinations. This is important because, at first glance, you might think the OD cost matrix solver would work best, but actually it's probably best to do the following using a route layer instead:

1. On your dataset, create a new field named RouteName and calculate its value so that it is the same value as your current ID field.
2. Add your origins to ArcMap as a layer. (Tip: File > Add Data > Add XY Data.) Only specify the origin X and Y fields.
3. Rename the output layer that appears in the table of contents to something like Origins.
4. Add your destinations to ArcMap as a layer. Only specify the destination X and Y fields.
5. Rename the output layer to Destinations.
6. Make a Route layer using the Network Analyst toolbar (or a GP tool).
7. Load the Origins layer into the Stops class. (Tip: Right-click Stops in the Network Analyst window and choose Load Locations.) Make sure the RouteName field is mapped to the RouteName field you created.
8. Load the Destinations layer into the Stops class using the same method.
9. Solve

By specifying the route name when loading, the stops are grouped together and routes are calculated only for the stops that are in the same group, which in your case is limited to a single origin and destination pair.

You can open, and optionally export, the Routes class, which contains the calculated shortest-path driving distances. The Name field values will match the values of your original IDs.


Thanks a lot for the step by step description. I'm also new to Network Analyst but I did follow the same steps trying to calculate the driving distance from a patients layer to their closest doctor's locations. I can populate the stops exactly as you described, but looks my route layer didn't get populated because in Network Analysts window, the number of routes is 0.

I used a single statewide road shapefile to create my new network dataset and then built a network dataset that contains three features, the source road layer, the edge layer, and the junction layer.

After that, I read in origins and destinations data from an Excel table exactly as you described.

After read in point XY data, I clicked to create a new route, so the Network Analyst window is populated with bunch of layers, but with all layers including the stops layer and the route layer empty.

I then loaded the origins and destinations layer to stops, click on "solve" on the Network Analyst Toolbar that is beside the "Directions Window". Then ArcINFO 10 gave me an error saying "The network dataset has no edge elements. It may be unbuilt."

I guess I might did something wrong when creating the new route but not sure. I would highly appreciate if you or anybody could give a more detailed step by step instruction about what's wrong in my steps.

Xiaomin

Geosptial & Population Studies, UNM
0 Kudos
JaySandhu
Esri Regular Contributor
"The network dataset has no edge elements. It may be unbuilt."


As the message says, the problem is with the network dataset and not with the route layer.
If the network has no edges perhaps it needs to be "built". Also if it has no edges then the
stops you loaded have no where to snap to and will need to be re-loaded or their locations
re-calculated once the edges are there.

You mention that you created and build the network. When you add the network dataset to
ArcMap, say NO to adding the source features. Now, does anything draw? Or if you bring
up the properties of the network dataset, what does it say on it's status?

Jay Sandhu
0 Kudos
SalmanAhmed
Deactivated User

"The network dataset has no edge elements. It may be unbuilt." I have this same problem. And the status in the properties says it is unbuilt. But when I try to build it I get another error saying 'ND cannot be built. Network object evaluation error'. What mistake am I doing could please guess? I have a normal street network of a city with edge elements. N Im building this network dataset from a shapefile and not in a feature dataset.

0 Kudos
XiaominRuan
Emerging Contributor
As the message says, the problem is with the network dataset and not with the route layer.
If the network has no edges perhaps it needs to be "built". Also if it has no edges then the
stops you loaded have no where to snap to and will need to be re-loaded or their locations
re-calculated once the edges are there.

You mention that you created and build the network. When you add the network dataset to
ArcMap, say NO to adding the source features. Now, does anything draw? Or if you bring
up the properties of the network dataset, what does it say on it's status?

Jay Sandhu


Jay thank you very much for the reply! I figured out how to it finally. I used "New Closest Facility" Function to load origins and destinations separately and then all routes were calculated and showed up. I thought the previous issue I had is, my dataset is too large. I have more than 50,000 patients point data which I wanted to  connect with their respective closest of more than 10,000 health care facilities. Once I selected a small sample of both and tried, there is no problem at all.

Thank you so much for the answer. It helped a lot. I just wonder, do you happen to have any experience about how to play with large dataset? Like in my case, is there a way that I can do the route calculation for all 50,000 patients at once?

Regards,

Xiaomin
0 Kudos
JaySandhu
Esri Regular Contributor
If you only need to know the location and distance then use the OD Cost Matrix solver. But if you need the actual route to be shown then continue to use Closest Facility.

To solve your problem of finding ONE closest hospital, set a cutoff distance or time, say 60 miles or 60 minutes.
(i.e.. what ever is reasonable in your case).
Turn off hierarchy.
Set number of facilities to find as 1.
Solve.

it should work with 50,000 incidents and 10,000 facilities.
If it does not, can you report back to how far it gets or what error message is reported.

Also, If you are using these points over and over again, I will suggest that you run the GP tool, Calculate Locations on your hospitals and patients so that you can load them by network locations (not geometry) into a new network layer.

Jay Sandhu
0 Kudos