Select to view content in your preferred language

Checking math in OD Cost Matrix

1173
6
Jump to solution
04-06-2023 12:04 PM
JenniferGrove
Emerging Contributor

Hi,

I am graduate school student working on a project and have a question regarding OD Cost Matrix.

I have a street network dataset created with junctions.  I have a feature class with points for origins and destinations.  My SPEEDLIMIT is miles/hour and my projection is a State Plane (feet).  I am using 35 mi/hour as a constant in the SPEEDLIMIT field for this scenario.

I'm trying to run an OD Cost Matrix and have a question regarding the results.  I've run the process for both driving time (min) and distance (mi).  I've paired the answers together below in the screenshot.  

I've checked the length of the segments and the total length is correct.  However, I get roughly 7 minutes as the driving time.  The total minutes reports 8.8.

Would someone please help me understand what accounts for the difference?  I understand that a vehicle could not go through each intersection at 35 mi/hr.  However, I'm not sure what is happening programmatically to account for the extra time it takes to complete the path.  I'm thinking this has to do with the junction points but do not know these affect the end drive time.

Drive Time vs Driving DistanceDrive Time vs Driving Distance

 

 

 

 

Thanks,

Jennifer

 

 

0 Kudos
1 Solution

Accepted Solutions
JaySandhu
Esri Regular Contributor

The SPEEDLIMIT field is being used. The speed_limit = 25 line is a fail safe in case some road does not have a limit defined. The issue I believe is the scale factor. You are getting 7 minutes. If you multiply it by 1.25 you will get 8.75 which is close to what you should have gotten.

So, I think it was the scale factor that was making your travel time coming back more than the posted speed limit.

Jay Sandhu

View solution in original post

0 Kudos
6 Replies
JaySandhu
Esri Regular Contributor

When you run the OD analysis, it does not generate the actual shortest path that was taken. So you cannot sum up the edge lenght/minutes that were travelled on.

So, what you can do is, take that one OD pair that you are looking at, one with the 8.8 minutes, I believe the origin 1 to destination 8 and solve a route on that. That is, create a route layer, load the 1 and 8 as the two stops and solve. Do you still get the same answer? Now, you can run the GP tool, Copy Traversed Source Features on the resulting route layer. This will create edges, junctions and turn feature classes that contain all the features that were traversed in the shortest path. Now you can add up the edge lengths/travel times and see if they all add up.

Regards,

Jay Sandhu

0 Kudos
JenniferGrove
Emerging Contributor

Hi Jay, Thank you for your response!  I tried what you suggested.  I do get the same route along the network and the same cumulative length for the route at 21,690 ft.  My cumulative time for the route is the same at 8.8 min.  However, at 35 mi/hr a vehicle would not traverse 21,690 ft in 8.8 min but roughly 7 minutes.  When I use the route layer and results from the GP tool you mentioned, I calculate that the speed for each edge is 28 mi/hour.  I would like to understand why the network analysis is using 28 mi/hour instead of what I intended (in my input streets table all the rows in the field SPEEDLIMIT are 35 mi/hr).  I need to ensure the speed is at 35 mi/hr for my scenario.   I would really appreciate it if you could explain further.  Maybe I am missing something.  Thank you again!  --Jennifer

0 Kudos
JaySandhu
Esri Regular Contributor

I am assuming you are using ArcGIS Pro.

Some questions to ask about your network. What is the name of the travel time attribute? I assume it is minutes. How were the values calculated for it from your 35 miles per hour speed? Just having a field called speed limit by itself not do anything. Its values have to be used to compute the Minutes field which should then be loaded into the network during the build phase.

You can check the values stored in the network as follows:

If you have added the network dataset to the map, then you can bring up the Data tab and click on the Explore Network tool. Now click on a network edge and see what information is stored on the network in terms of the impedance values.

Jay Sandhu

0 Kudos
JenniferGrove
Emerging Contributor

Yes, I am using ArcGIS Pro.  You are correct, my travel time attribute is minutes.  When I look at the minutes, I can see where the calculation is wrong.  How do I get the minutes to reference my input streets table field called SPEEDLIMIT?  I used the ESRI tutorial Create Local Government Network Dataset as a guide to creating my street network dataset.  I pulled some roads from a county GIS and then digitized the rest of the roads off satellite imagery.  The roads were all put into a RoadCenterline feature class that is the source for the edges evaluator in my costs. 

For the minutes there is a script in use for the edges evaluator.

The Python script for along the edges (and also against) has a result = minutes(!Shape_Length!, !SPEEDLIMIT!). 

The Code Block has:

def minutes(length, speed_limit):
# speed_limit assumed to be in miles per hour
# length assumed to be in feet
if not speed_limit:
# Set speed limit to 25 MPH if none specified
speed_limit = 25
# Scale factor reflecting a difference in
# travel time between posted speed and
# typical actual travel speed
scale_factor = 1.25
# 1 mph = 88 feet/minute
minutes = scale_factor * length / (speed_limit * 88)
return minutes

Thank you for your help to identify where the speed is pulled for the driving time calculation.  I just modified the speed_limit to be 35 and the scale factor to 1 for my scenario to work.  However, I would like in the future to pull the data from the source feature class RoadCenterline so I can use the appropriate speed for the roads.

0 Kudos
JaySandhu
Esri Regular Contributor

The SPEEDLIMIT field is being used. The speed_limit = 25 line is a fail safe in case some road does not have a limit defined. The issue I believe is the scale factor. You are getting 7 minutes. If you multiply it by 1.25 you will get 8.75 which is close to what you should have gotten.

So, I think it was the scale factor that was making your travel time coming back more than the posted speed limit.

Jay Sandhu

0 Kudos
JenniferGrove
Emerging Contributor

Ok, thank you so much for your help walking me through this process.  I have learned more about network analyst and appreciate the guidance!