0

Can some one tell me whats wrong here. The geoprocessing job always fails and i don't see much info in firebug to debug. This is my code to generate the feature set.

var inputFeature = {
    displayFieldName: "",
    hasM: true,
    hasZ: true,
    geometryType: "esriGeometryPolyline",
    spatialReference: {
        wkid: 3460,
        latestWkid: 3460
    },
    fields: [
    {
        name: "OBJECTID",
        type: "esriFieldTypeOID",
        alias: "OBJECTID"
    },
    {
        name: "RoadID",
        type: "esriFieldTypeString",
        alias: "RoadID",
        length: 10
    },
    {
        name: "Shape_Length",
        type: "esriFieldTypeDouble",
        alias: "Shape_Length"
    }
    ],
    features: [{
        geometry: geom,//poly line geometry returned from a query task
        attributes: { OBJECTID: 1, RoadID: $('#RoadIdTextBox').val(), Shape_Length: 0.00 }
    }],
    exceededTransferLimit: false
}

var searchRadius = {
    distance: $('#SearchRadius').val() / 1,
    units: "esriMeters"
}

var IRIParams = { "Input_Route_Features": inputFeature, "Search_Radius": searchRadius };

console.log(dojo.toJson(inputFeature));
gp.submitJob(IRIParams);

gp.on("status-update", function (e) {
    console.log(e);
});`

This is the output when i console.log() inputFeature

{
        "displayFieldName": "",
        "hasM": true,
        "hasZ": true,
        "geometryType": "esriGeometryPolyline",
        "spatialReference": { "wkid": 3460, "latestWkid": 3460 },
        "fields": [{ "name": "OBJECTID", "type": "esriFieldTypeOID", "alias": "OBJECTID" },
            { "name": "RoadID", "type": "esriFieldTypeString", "alias": "RoadID", "length": 10 },
            { "name": "Shape_Length", "type": "esriFieldTypeDouble", "alias": "Shape_Length" }],
        "features": [{
            "geometry": {
                "type": "polyline", "paths": [[[1966832.8483635725, 3875011.726536308, 0, 1189], [1966841.088767071, 3875017.3918245276, 0, 1199]]],
                "_path": 0, "hasZ": true, "hasM": true, "spatialReference": { "wkid": 3460 }
            }, "attributes": { "OBJECTID": 1, "RoadID": "10239011", "Shape_Length": 0 }
        }],
        "exceededTransferLimit": false
    }

It even fails when i paste and run the output in the services directory interface.

  • 1
    What's the error from the gp service when you paste into the rest endpoint? – KHibma May 29 '15 at 2:55
  • When i changed the services execution mode to be synchronous: Unable to complete operation. Error executing tool. – Shalvendra Sukul May 29 '15 at 2:59
0

I solved it using the JSON to Features tool. I write my inputFeature value to a json file using a web method which is saved in a predefined location. After the json file is over written i call my gp service.

And from now on i will make sure none of my services will have complex data types as parameters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.