Problem with Vehicle Routing Problem task in js and python

03-23-2017 06:47 AM
New Contributor III



I'm trying to create a Python geprocessing script for the network analyst Vehicle Routing Problem task.


Here is a part of the Python script:


inOrders = arcpy.GetParameterAsText(0)

inDepot = arcpy.GetParameterAsText(1)

inRoute = arcpy.GetParameterAsText(2)

timeUnits = arcpy.GetParameterAsText(3)

distanceUnits = arcpy.GetParameterAsText(4)





def SolveVehicleRoutingProblem():



       pathND = r"\\XXXXX\YYYYY\GNEXT_Road_Network_1.gdb\ND_UTM_33\Tripoli_UTM_33_ND"

       outResult, inDepot, inRoute, "", timeUnits, distanceUnits, pathND, ,"",""," ","","","","","","","","","", pointsBarriers,lineBarriers,polygonsBarriers,"","","",restrictions)

       #arcpy.SetParameter(9, outResult)


pointsBarriers, lineBarriers, polygonsBarriers, and restrictions are optional parameters


When I run the Python script from ArcMap I think it works fine, although no gdb file is generated in the scratch local folder.

 After running the script I public the script as a geoprocessing  service, but when I consuming it with javascript I get the following error:

  • esriJobMessageTypeInformative: Input field [OID] was not mapped to a field in the network analysis class "Orders". Input field [OID] was not mapped to a field in the network analysis class "Depots". Input field [OID] was not mapped to a field in the network analysis class "Routes". Depots (Name = "Location 1") is unlocated. Routes (Name = "Item1") does not have a StartDepotName value nor an EndDepotName value. Orders (Name = "Location 1") is unlocated. WARNING 030088: Solve returned an error, but errors were converted to warnings. WARNING 030092: VRP Solver failed due to invalid input.

I do not know why the word “Location 1” appears in the error, because it does not appear in either the js code or the python code.

The javascript code is as follows:



  var params = {

                //"Breaks": "",

                //"pathND": pathND,

                "timeUnits": "Minutes",

                "distanceUnits": "Meters",

                "inDepot": '{"features":[{"geometry":{"x":' + xDepotPoint + ',"y":' + yDepotPoint + '},"attributes":{"Name": "inDepot"}}]}',

                "inOrders": '{"features":[{"geometry":{"x":' + xOrdersPoint + ',"y":' + yOrdersPoint + '},"attributes":{"Name": "inOrders"}}]}',

                "inRoute": '{"features":[{"attributes":{"Name":"outputRouteVRP","StartDepotName": "inDepot","EndDepotName":"inDepot"}}]}',




  = new Geoprocessor(THE URL);



 , lang.hitch(this, this.processingComplete),     this.gpJobStatus, this.gpJobFailed);



        processingComplete: function (jobinfo) {


  , "outResult", this.showRoutes);


            if (jobinfo.jobStatus == 'esriJobSucceeded') {




            else if (jobinfo.jobStatus == "esriJobFailed") {

                dom.byId('statusGPOP').innerHTML = jobinfo.jobStatus;

                var errors = array.filter(jobinfo.messages, function (item) {

                    return item.type === "esriJobMessageTypeError";


                for (var e = 0; e < errors.length; e++) {

                    //Poner el texto en el div de resultados

                    var span = $('<p/>').addClass('errorGP').html(errors.description);






showRoutes: function(results) {

            var features = results.value.features;

            var symbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([243, 156, 18]), 4);



In "\arcgisserver\directories\arcgisjobs\solvevehicleroutingproblem_gpserver\jea6d11970a3c467bad8a104ca8aae98e\scratch"  a gdb file is generated but it is empty.


Any suggestions? Are the input parameters correct?


Thank you very much.

0 Kudos
0 Replies