How do I get the length of shortest route by arcpy after solve the NA

1344
6
Jump to solution
11-06-2016 07:21 AM
XiangNingJiao1
New Contributor II

I use arcpy.na.MakeRouteLayer build a layer, and use arcpy.na.AddLocations add two stop points, and use arcpy.na.Solve get the shortest route. But how can I get the length of the shortest route.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

the polylineM field represents the geometry, use the standard methods for reading geometries

Reading geometries—Help | ArcGIS for Desktop 

View solution in original post

6 Replies
DanPatterson_Retired
MVP Emeritus

in here, they use the getoutput object and savetolayer to produce the layer, so from there you should be able to get the geometry and calculate its length

Solve—Help | ArcGIS for Desktop 

0 Kudos
XiangNingJiao1
New Contributor II

Hi, Dan Patterson, Thanks for your answer.But I don't know how to get the geometry of the na result layer, how to do that?

I get the Route_Layer1 after solve , the Routes has a attribute table .

0 Kudos
DanPatterson_Retired
MVP Emeritus

the polylineM field represents the geometry, use the standard methods for reading geometries

Reading geometries—Help | ArcGIS for Desktop 

XiangNingJiao1
New Contributor II

With your help, I sovle the problem, thany you very much.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Good!!  Now, perhaps you could close the thread with the answer that solved it or mark it as assumed answer, so that there is some closure for other people looking for similar responses

0 Kudos
XiangNingJiao1
New Contributor II

OK, I will do it.

0 Kudos