Load a shapefile as orders in VRP using arcpy

548
3
Jump to solution
05-25-2018 03:03 AM
sotokan80_
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)
0 Kudos
1 Solution

Accepted Solutions
sotokan80_
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

0 Kudos
3 Replies
DanPatterson_Retired
MVP Emeritus

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

0 Kudos
sotokan80_
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.

0 Kudos
sotokan80_
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.

0 Kudos