Load a shapefile as orders in VRP using arcpy

176
3
Jump to solution
05-25-2018 03:03 AM
Highlighted
New Contributor III

I' m facing the following issue when trying to load a shapefile as orders in VRP solver using arcpy.

The code that i m using:

inOrders = "sortedStops"
orders = arcpy.GetParameterValue("SolveVehicleRoutingProblem_na",0)
orders.load(inOrders)

the errror message that i get;

File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\arcobjects\arcobjects.py", line 1042, in load
return convertArcObjectToPythonObject(self._arc_object.Load(*gp_fixargs(args)))
RuntimeError: RecordSetObject: Cannot open table for Load

The input shapefile has the following attribute table, which is of course doesn't resemble orders attribute table.

Any suggestions?

Tags (3)
Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
New Contributor III

i found solution to my problem using MakeVehicleRoutingProblemLayer  and arcpy.na.AddLocations instead of SolveVehicleRoutingProblem_na. Thank you very much, for your reply.

View solution in original post

Reply
0 Kudos
3 Replies
Highlighted
MVP Esteemed Contributor

What does your orders file look like? It appears to require specific inputs

http://pro.arcgis.com/en/pro-app/tool-reference/network-analyst/solve-vehicle-routing-problem.htm

Reply
0 Kudos
Highlighted
New Contributor III

ok, but how am i supposed to make my orders file with the same format? Another issue is that orders attribute table's fields have many characters whilst mine cannot exceed 10.

Reply
0 Kudos
Highlighted
New Contributor III

i found solution to my problem using MakeVehicleRoutingProblemLayer  and arcpy.na.AddLocations instead of SolveVehicleRoutingProblem_na. Thank you very much, for your reply.

View solution in original post

Reply
0 Kudos