AnsweredAssumed Answered

XY not in correct location via GP tool

Question asked by jay.kapalczynski on Oct 3, 2019
Latest reply on Oct 30, 2019 by jay.kapalczynski

I have an application that I am testing out.  But first a little back information


My Steps:

I created a simple Python script that creates a new point in a FeatureClass. (see below)

I then add this script to a toolbox

I then set the parameters for the Classification, X and Y in the properties (Classifcation=string, XY are set to double)

I can run this with hard coded values via IDLE and it works fine as seen below



Seeing that the script works in IDLE I publish a GP Service from the process I just ran to my ArcGIS Server.

I can run the GP Service from our ArcGIS Server and it runs fine.



I then reference this from AppStudio and attempt to run it with hard coded values as seen below


1. I can get it to run and create a new point THIS WORKS

2. BUT the XY coordinates I feed it don't appear where they should.  If I use the EXACT same ones that I use in the script below they don't show up in the same place as the points added .


The data in SDE is WGS 84 decimal degrees.



If I hard code the XY in the script and run from IDLE it works fine

If I add the exact same Coordinates from the GP Service that I published in ArcGIS Service it works fine

If I hard code the exact same Coordinates as seen below in AppStudio it puts the points at roughly (-78, 39)

      I dont see where and how to coordinates I am submitting in the job are being converted from (-77.43153, 37.527056) to (-78, 39)

     Funny thing is if I export the data and calculate XY for the points the ones done through AppStudio are truncated and have no Sig Figs, while the points added in the Service and Script via IDLE have sig figs.


Very confused.  Seems the sig figs are being dropped but then again the XY corrds are goin from 77 to 78 and 37 to 39?




I know this is a lot to digest but figure someone might have seen this before?



import arcpy
from arcpy import env
import os

#varXCoord = arcpy.GetParameterAsText(4)
#varYCoord = arcpy.GetParameterAsText(5)
#varClassification = arcpy.GetParameterAsText(6)

varClassification = "New Classification"
varYCoord = "37.527056"
varXCoord = "-77.43153"

fc = ''
workspace = arcpy.env.workspace = r'C:\Users\x\AppData\Roaming\ESRI\Desktop10.5\ArcCatalog\x@xxxxxxx.sde'

## Start an edit session. Must provide the workspace.
edit = arcpy.da.Editor(workspace)

edit.startEditing(False, False)

## Start an edit operation

row_values = [( varXCoord ,varYCoord, varClassification)]

cursor = arcpy.da.InsertCursor(fc,['SHAPE@X', 'SHAPE@Y', 'Classification'])
for row in row_values:  
del cursor
## Stop the edit operation.

## Stop the edit session and save the changes



GeoprocessingTask {
   id: insertCursorTask
   url: "https://xxx.xx.xxxx.xx/arcgis/rest/services/xxx/InsertCursor/GPServer/InsertCursor/submitJob"

   function insertFunction() {

       var varClassification = "New Classification";
       var xlocation = -77.43153;
       var ylocation = 37.527056;

       var gpParametersInsert = ArcGISRuntimeEnvironment.createObject("GeoprocessingParameters",
     {executionType: Enums.GeoprocessingExecutionTypeSynchronousExecute});

       var inputsI = {};

       inputsI["classification"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: varClassification});
       inputsI["SHAPE@X"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: xlocation });
       inputsI["SHAPE@Y"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: ylocation });

       //var inputresults = inputs;
       gpParametersInsert.inputs = inputsI;

       // Create the job that handles the communication between the application and the geoprocessing task
       insertCursorJob = insertCursorTask.createJob(gpParametersInsert);

       console.log("gp job: " + JSON.stringify(insertCursorJob));