AnsweredAssumed Answered

Run Geo-processing Service

Question asked by nikfal on Nov 27, 2017
Latest reply on Nov 30, 2017 by nikfal

HI, I am trying to run a very simple python tool as Geo-processing Service. As usual I created the tool as follows:

import arcpy

inputLong = float(arcpy.GetParameterAsText(0))
inputLat = float(arcpy.GetParameterAsText(1))
xy = [(inputLat, inputLong)]

fc = r"Database Connections\Connection to XXX-XXXXX.sde\A.DBO.CropPoint"
cursor = arcpy.da.InsertCursor(fc, ["SHAPE@XY"])
for row in xy:
    cursor.insertRow([row])
del cursor

and shared as Geo-processing Service on my ArcGIS server. On JavaScript I wrote the code as  follows:

            var gpUrl = "http://XXX-XXXXX:6080/arcgis/rest/services/Script2/GPServer";

            var gp = new Geoprocessor(gpUrl);

                            var params1 = {
                                Longitude: -101.55,
                                Latitude: 35.6
                            };
                            gp.submitJob(params1);

It does not work (i.e. does not add point to my point map), however I can directly run it in the "ArcGIS REST Services Directory" on my browser. Also I tried "gp.execute(params1)" to run the tool.

Outcomes