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
Next:
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.
Finally:
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.
MY ISSUE:
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?
<SPAN class="keyword token">import</SPAN> arcpy
<SPAN class="keyword token">from</SPAN> arcpy <SPAN class="keyword token">import</SPAN> env
<SPAN class="keyword token">import</SPAN> os
<SPAN class="comment token">#varXCoord = arcpy.GetParameterAsText(4)</SPAN>
<SPAN class="comment token">#varYCoord = arcpy.GetParameterAsText(5)</SPAN>
<SPAN class="comment token">#varClassification = arcpy.GetParameterAsText(6)</SPAN>
varClassification <SPAN class="operator token">=</SPAN> <SPAN class="string token">"New Classification"</SPAN>
varYCoord <SPAN class="operator token">=</SPAN> <SPAN class="string token">"37.527056"</SPAN>
varXCoord <SPAN class="operator token">=</SPAN> <SPAN class="string token">"-77.43153"</SPAN>
fc <SPAN class="operator token">=</SPAN> <SPAN class="string token">'xE.DBO.xyz'</SPAN>
workspace <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'C:\Users\x\AppData\Roaming\ESRI\Desktop10.5\ArcCatalog\x@xyz.sde'</SPAN>
<SPAN class="comment token">## Start an edit session. Must provide the workspace.</SPAN>
edit <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>Editor<SPAN class="punctuation token">(</SPAN>workspace<SPAN class="punctuation token">)</SPAN>
edit<SPAN class="punctuation token">.</SPAN>startEditing<SPAN class="punctuation token">(</SPAN><SPAN class="token boolean">False</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="token boolean">False</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">## Start an edit operation</SPAN>
edit<SPAN class="punctuation token">.</SPAN>startOperation<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
row_values <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">(</SPAN> varXCoord <SPAN class="punctuation token">,</SPAN>varYCoord<SPAN class="punctuation token">,</SPAN> varClassification<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>row_values<SPAN class="punctuation token">)</SPAN>
cursor <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>InsertCursor<SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">'SHAPE@X'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'SHAPE@Y'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'Classification'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">for</SPAN> row <SPAN class="keyword token">in</SPAN> row_values<SPAN class="punctuation token">:</SPAN>
cursor<SPAN class="punctuation token">.</SPAN>insertRow<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">del</SPAN> cursor
<SPAN class="comment token">## Stop the edit operation.</SPAN>
edit<SPAN class="punctuation token">.</SPAN>stopOperation<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">## Stop the edit session and save the changes</SPAN>
edit<SPAN class="punctuation token">.</SPAN>stopEditing<SPAN class="punctuation token">(</SPAN><SPAN class="token boolean">True</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>GeoprocessingTask <SPAN class="punctuation token">{</SPAN>
id<SPAN class="punctuation token">:</SPAN> insertCursorTask
url<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"https://xyz.xyz.xyz.xyz/arcgis/rest/services/xyz/InsertCursor/GPServer/InsertCursor/submitJob"</SPAN>
<SPAN class="keyword token">function</SPAN> <SPAN class="token function">insertFunction</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">var</SPAN> varClassification <SPAN class="operator token">=</SPAN> <SPAN class="string token">"New Classification"</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> xlocation <SPAN class="operator token">=</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="number token">77.43153</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> ylocation <SPAN class="operator token">=</SPAN> <SPAN class="number token">37.527056</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> gpParametersInsert <SPAN class="operator token">=</SPAN> ArcGISRuntimeEnvironment<SPAN class="punctuation token">.</SPAN><SPAN class="token function">createObject</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"GeoprocessingParameters"</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="punctuation token">{</SPAN>executionType<SPAN class="punctuation token">:</SPAN> Enums<SPAN class="punctuation token">.</SPAN>GeoprocessingExecutionTypeSynchronousExecute<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> inputsI <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">{</SPAN><SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">;</SPAN>
inputsI<SPAN class="punctuation token">[</SPAN><SPAN class="string token">"classification"</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> ArcGISRuntimeEnvironment<SPAN class="punctuation token">.</SPAN><SPAN class="token function">createObject</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"GeoprocessingString"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">{</SPAN>value<SPAN class="punctuation token">:</SPAN> varClassification<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
inputsI<SPAN class="punctuation token">[</SPAN><SPAN class="string token">"SHAPE@X"</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> ArcGISRuntimeEnvironment<SPAN class="punctuation token">.</SPAN><SPAN class="token function">createObject</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"GeoprocessingString"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">{</SPAN>value<SPAN class="punctuation token">:</SPAN> xlocation <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
inputsI<SPAN class="punctuation token">[</SPAN><SPAN class="string token">"SHAPE@Y"</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> ArcGISRuntimeEnvironment<SPAN class="punctuation token">.</SPAN><SPAN class="token function">createObject</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"GeoprocessingString"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">{</SPAN>value<SPAN class="punctuation token">:</SPAN> ylocation <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">//var inputresults = inputs;</SPAN>
gpParametersInsert<SPAN class="punctuation token">.</SPAN>inputs <SPAN class="operator token">=</SPAN> inputsI<SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">// Create the job that handles the communication between the application and the geoprocessing task</SPAN>
insertCursorJob <SPAN class="operator token">=</SPAN> insertCursorTask<SPAN class="punctuation token">.</SPAN><SPAN class="token function">createJob</SPAN><SPAN class="punctuation token">(</SPAN>gpParametersInsert<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
console<SPAN class="punctuation token">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"gp job: "</SPAN> <SPAN class="operator token">+</SPAN> JSON<SPAN class="punctuation token">.</SPAN><SPAN class="token function">stringify</SPAN><SPAN class="punctuation token">(</SPAN>insertCursorJob<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
insertCursorJob<SPAN class="punctuation token">.</SPAN><SPAN class="token function">start</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>