|
POST
|
Well with the help of ESRI supports eyes we have located the problem. A little embarrassed at this point.... The problem was in the hand shake from AppStudio to the Published GP Tool in ArcGIS Server 1. I wrote the python script with an insertCursor and this ran fine 2. I created and added this script to a GP tool in desktop 3. I set the parameters and then ran with no data, successful (GPS params were eSHAPE@x and fSHAPE@Y) 4. I took the result and published to ArcGIS Server 5. I then ran the insert from this GP tool RestEndpoint and it ran fine Now here is where I went wrong. In AppStudio I was using the parameter name from the parameters set in step 3 above inputsI["eSHAPE@X"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingDouble", {value: xlocation}); inputsI["fSHAPE@Y"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingDouble", {value: ylocation}); Upon closer look at the GP Tool published to ArcGIS Server the names if the parameters were: eSHAPE_X and fSHAPE_Y I modified the code in AppStudio to this and it worked. inputsI["eSHAPE_X"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingDouble", {value: xlocation}); inputsI["fSHAPE_Y"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingDouble", {value: ylocation}); NOW comes my final question. How do I return the JobID number and Status code of this call to the GP Tool???? I want to test if successful or unsuccessful I am using the below code to .createjob and pass my parameters... // Create the job that handles the communication between the application and the geoprocessing task updateCursorJob = updateCursorTask.createJob(gpParameters); console.log("gp job: " + JSON.stringify(updateCursorJob)); updateCursorJob.start(); I can do something like this in a NetworkRequest BUT how do I do this from the CREATEJOB that I am doing below... NetworkRequest {
id: uploadRequest
url: "https://xxxx/arcgis/rest/services/xx/InsertCursor/GPServer/InsertCursor/submitJob"
method: "POST"
headers.referrer: "https://www.arcgis.com/home/index.html"
headers.userAgent: "Mozilla/5.0"
onReadyStateChanged: {
if ( readyState === NetworkRequest.DONE ) {
//result.text = responseText
console.log("response text: " + responseText);
var obj = JSON.parse(responseText);
objJobID = obj.jobId;
objJobStatus = obj.jobStatus;
console.log("jobId: " + objJobID);
console.log("jobStatus: " + objJobStatus);
console.log("log: " + url)
//verifyRequest.send({adds: "/"+ objJobID, f:"json"});
}
}
onError: console.log(errorText + ", " + errorCode); //result.text = errorText + ", " + errorCode
}
... View more
10-24-2019
06:15 AM
|
0
|
6
|
6174
|
|
POST
|
Yea I am confused...but it displays as a property in my last post in red...this is what I get from a console.log of the GP Processing object
... View more
10-17-2019
10:32 AM
|
0
|
0
|
884
|
|
POST
|
I am trying to update the Object for gpParametersInsert to include a Spatial Reference....but its erroring out as seen above qml: gp job: {"objectName":"","objectType":"GeoprocessingJob","error":null,"objects":{},"json":{"geoprocessingJob":{"needGpMapServiceUrl":false,"parameters":{"executionType":"submit","parameters":[{"dataType":"GPString","direction":"esriGPParameterDirectionInput","name":"aItem","value":"shooter"},{"dataType":"GPString","direction":"esriGPParameterDirectionInput","name":"bPublicPrivate","value":"public"},{"dataType":"GPString","direction":"esriGPParameterDirectionInput","name":"cCaseNum","value":"77"},{"dataType":"GPString","direction":"esriGPParameterDirectionInput","name":"dComments","value":"-162.43153 33.527056"},{"dataType":"GPDouble","direction":"esriGPParameterDirectionInput","name":"eSHAPE@X","value":-162.43153},{"dataType":"GPDouble","direction":"esriGPParameterDirectionInput","name":"fSHAPE@Y","value":33.527056},{"dataType":"GPString","direction":"esriGPParameterDirectionInput","name":"gSHAPE@XY","value":"(-115.3252,50.65654)"},{"dataType":"GPString","direction":"esriGPParameterDirectionInput","name":"hclassification","value":"Boating"}],"returnM":false,"returnZ":false},"url":"https://xx.gov/arcgis/rest/services/Tools/InsertCursor/GPServer/InsertCursor/submitJob"},"jobType":"geoprocessingJob","status":"notStarted"},"unknownJson":{},"unsupportedJson":{},"jobType":4,"messages":{},"serverJobId":"","progress":0,"jobStatus":0,"error":null,"credential":{"objectName":"","objectType":"Credential","error":null,"objects":{},"username":"","password":"","authenticationType":0,"referer":"","token":"","tokenExpiry":null,"tokenServiceUrl":"","oAuthClientInfo":null,"oAuthAuthorizationCode":"","oAuthRefreshToken":"","pkcs12Info":null,"sslRequired":false,"authenticatingHost":"","objects":{}},"requestConfiguration":{"objectName":"","objectType":"RequestConfiguration","error":null,"objects":{},"timeoutInterval":60,"maxNumberOfAttempts":5,"forcePost":false,"issueAuthenticationChallenge":true,"userHeaders":{}},"url":"","checkStatusTaskStatus":0,"objects":{},"result":null,"parameters":{"objectName":"","objectType":"GeoprocessingParameters","error":null,"objects":{},"executionType":0,"inputs":{"aItem":{"objectName":"","objectType":"GeoprocessingString","error":null,"objects":{},"parameterType":9,"value":"shooter"},"bPublicPrivate":{"objectName":"","objectType":"GeoprocessingString","error":null,"objects":{},"parameterType":9,"value":"public"},"cCaseNum":{"objectName":"","objectType":"GeoprocessingString","error":null,"objects":{},"parameterType":9,"value":"77"},"dComments":{"objectName":"","objectType":"GeoprocessingString","error":null,"objects":{},"parameterType":9,"value":"-162.43153 33.527056"},"eSHAPE@X":{"objectName":"","objectType":"GeoprocessingDouble","error":null,"objects":{},"parameterType":3,"value":-162.43153},"fSHAPE@Y":{"objectName":"","objectType":"GeoprocessingDouble","error":null,"objects":{},"parameterType":3,"value":33.527056},"gSHAPE@XY":{"objectName":"","objectType":"GeoprocessingString","error":null,"objects":{},"parameterType":9,"value":"(-115.3252,50.65654)"},"hclassification":{"objectName":"","objectType":"GeoprocessingString","error":null,"objects":{},"parameterType":9,"value":"Boating"}},"outputSpatialReference":null,"processSpatialReference":null,"returnM":false,"returnZ":false}}
... View more
10-16-2019
11:30 AM
|
0
|
0
|
884
|
|
POST
|
I am trying to set the Spatial Reference as seen below...but for some reason its not liking it... gpParametersInsert.outputSpatialReference = SpatialReference.createWgs84(); If I include the line above as seen in the code below and run the app I get an error window that pops up....no error in the console.log "AppStudio for ArcGIS AppRun has stopped woroking" ANY ideas? var gpParametersInsert = ArcGISRuntimeEnvironment.createObject("GeoprocessingParameters",
{executionType: Enums.GeoprocessingExecutionTypeAsynchronousSubmit});
// Request the output features be WGS84
gpParametersInsert.outputSpatialReference = SpatialReference.createWgs84();
var inputsI = {};
inputsI["Item"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: varItem});
gpParametersInsert.inputs = inputsI;
// Create the job that handles the communication between the application and the geoprocessing task
insertCursorJob = insertCursorTask.createJob(gpParametersInsert);
insertCursorJob.start();
... View more
10-15-2019
10:40 AM
|
0
|
3
|
978
|
|
POST
|
I am confused: 1. How can I see the url that is being submitted in its entirety? for verification purposes? 2. I assume this request is passing the values I put in the attributes section uploadRequest.send({adds:"[{\"attributes\":{\"description\":\"Networkrequest Sample\",\"Comments\":\"some comment\",\"timestamp\":null},\"geometry\":{\"paths\":[[-11542803.322978519,3129176.1574580222]],\"spatialReference\":{\"latestWkid\":3857,\"wkid\":102100}}}]", f:"json"}); 3. I am unclear how this is received and processed in the rest end point....where the other way I was doing this i could control them by name and parameters set in the GP tool. confused how the attributes are handled and the coordinates are handled on the GP side....do I need to create a new GP service? my inputs the other way have names that are captured by the GP service parameters....well I think thats how its happening... inputsI["aItem"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: varItem});
inputsI["bPublicPrivate"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: varPublicPrivate});
inputsI["cCaseNum"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: varCaseNum});
inputsI["dComments"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: xlocation + " " + ylocation});
inputsI["eSHAPE@X"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingDouble", {value: xlocation});
inputsI["fSHAPE@Y"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingDouble", {value: ylocation});
inputsI["gSHAPE@XY"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: centercoord});
inputsI["hCLassification"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: varClassification});
... View more
10-07-2019
10:38 AM
|
0
|
9
|
2321
|
|
POST
|
These are the results that I set to console.log.... Not sure how to return the entire url with the attributes attached....well I think thats what its supposed to be doing.. hmmmmm qml: response text: {"jobId":"jd64deeb127104dcb948ace3aae71f56c","jobStatus":"esriJobSubmitted"} qml: log: https://xxx.gov/arcgis/rest/services/Tools/InsertCursor/GPServer/Cursor/submitJob NetworkRequest {
id: uploadRequest
url: "https://xxx.gov/arcgis/rest/services/Tools/Cursor/GPServer/Cursor/submitJob"
method: "POST"
headers.referrer: "https://www.arcgis.com/home/index.html"
headers.userAgent: "Mozilla/5.0"
onReadyStateChanged: {
if ( readyState === NetworkRequest.DONE ) {
//result.text = responseText
console.log("response text: " + responseText);
console.log("log: " + url)
}
}
onError: console.log(errorText + ", " + errorCode); //result.text = errorText + ", " + errorCode
}
Button {
id: networkRequest
visible: true
text: "Network Request"
onClicked: {
uploadRequest.send({adds:"[{\"attributes\":{\"description\":\"Networkrequest Sample\",\"Comments\":\"some comment\",\"timestamp\":null},\"geometry\":{\"paths\":[[-11542803.322978519,3129176.1574580222]],\"spatialReference\":{\"latestWkid\":3857,\"wkid\":102100}}}]", f:"json"});
}
} // END OF INSERT BUTTON
... View more
10-07-2019
10:09 AM
|
0
|
11
|
2321
|
|
POST
|
still think I need to focus on your comment If the point shows that it is off the coast of Africa, that means it is 0,0 (meaning conversion issue from loosely-type javascript variable to GeoProcessingDouble Runtime object) or spatial reference related issues. if I set the XY parameter as text or double it works fine from the rest endpoint submit. If I do this from App Studio it does not work...how can the variable be destroyed on submit from appstudio??? If does not work when I send from the AppStudio app....although I am in the desktop mode....I have noticed that somethings don't work properly from the desktop mode...I am going to test from an actual installed application on a device.... If I am sending a string from the AppStudio app what can be the conversion failure??? Im not getting this....it should work the way I have it....uggggggg
... View more
10-06-2019
06:10 PM
|
0
|
1
|
1702
|
|
POST
|
Would it be as easy as something like this? Just wondering how I would grab this JSON on the GP side as I am specifying Parameters in the properties of the GP Tool..... NetworkRequest {
id: uploadRequest
url: "http://MY GP SERVICE URL"
method: "POST"
headers.referrer: "https://www.arcgis.com/home/index.html"
headers.userAgent: "Mozilla/5.0"
onReadyStateChanged: {
if ( readyState === NetworkRequest.DONE ) {
result.text = responseText
}
}
onError: result.text = errorText + ", " + errorCode
}
ColumnLayout {
Button {
id:upload
text: "Upload Request"
Layout.margins: 2
Layout.fillWidth: true
onClicked: {
uploadRequest.send({adds:"[{\"attributes\":{\"description\":\"Networkrequest Sample\",\"Comments\":\"some comment\",\"timestamp\":null},\"geometry\":{\"paths\":[[-11542803.322978519,3129176.1574580222]],\"spatialReference\":{\"latestWkid\":3857,\"wkid\":102100}}}]", f:"json"});
}
}
... View more
10-04-2019
12:32 PM
|
0
|
13
|
1703
|
|
POST
|
Im not seeing how to pass variables to the GP tool and then how to extract them to variables in the python script?
... View more
10-04-2019
12:18 PM
|
0
|
0
|
1702
|
|
POST
|
If I proceed down this path is there a way to receive a call back stating that the update was successful or if it failed?
... View more
10-04-2019
12:11 PM
|
0
|
3
|
1702
|
|
POST
|
Trying really hard with this....this is all new to me...QML etc.... So I don't want the user to click the screen I just want to get the center of the screen and use those coordinates... So I set this up on the map view to push XY coordinates to a global variable "currentLocation" every time the map moves. My thought was that I could take those variables and push them to the GP Tool and the python script to create a new point via python insert cursor. MapView{
id: mapView
onVisibleAreaChanged: {
var center = visibleArea.extent.center;
// Display center point
var test = visibleArea.spatialReference.wkText;
console.log(test);
var test4 = visibleArea.extent.center.x;
console.log(test4);
var test5 = visibleArea.extent.center.y;
console.log(test5);
var centercoord = CoordinateFormatter.toLatitudeLongitude(mapView.currentViewpointCenter.center, Enums.LatitudeLongitudeFormatDecimalDegrees, 6);
var ylocation = centercoord.substring(0,9);
var xlocation = centercoord.substring(12,21);
currentLocationX = xlocation
currentLocationY = ylocation
currentLocation = "x: -" + currentLocationX + " y: " + currentLocationY
} I call this function from a button right now.... I am trying to create a point object as you suggested from the "centercoord" variable that I can return in WGS84 BUT there is no - on the X value centercoord variable set to console.log gives me this: qml: Decimal Degrees : 38.116531N 077.625811W I am then trying to pass those values to the GP Tool but VERY VERY Confused... I don think I should be trying to pass a GeoprocessingFeatures if I am only trying to capture those values in the GP Tool as parameters??????? I think I need them as string values?????? ANY help would be most appreciated. GeoprocessingTask {
id: insertCursorTask
url: "https://vafwisdev.dgif.virginia.gov/arcgis/rest/services/DGIF_Tools/LECAInsertCursor/GPServer/InsertCursor/submitJob"
function insertFunction() {
var varItem = "shooter";
var varPublicPrivate = "public";
var varCaseNum = "77";
var varComments = "comments jump jump up and get down";
var varClassification = "Boating";
var centercoord = CoordinateFormatter.toLatitudeLongitude(mapView.currentViewpointCenter.center, Enums.LatitudeLongitudeFormatDecimalDegrees, 6);
console.log("Decimal Degrees : " + centercoord);
// Create a new feature collection using WGS84 as the OUTPUT
var inputFeatures = ArcGISRuntimeEnvironment.createObject("FeatureCollectionTable", {
geometryType: Enums.GeometryTypePoint,
spatialReference: SpatialReference.createWGS84()
});
// Create a new feature from the feature collection table. It will not have a coordinate location (x,y) yet
var inputFeature = inputFeatures.createFeature();
// Assign a physical location to the new point feature based upon where the user clicked on the map view
//inputFeature.geometry = mapView.currentViewpointCenter.center;
inputFeature.geometry = centercoord;
var inputsI = {};
inputsI["Item"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: varItem});
inputsI["PublicPrivate"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: varPublicPrivate});
inputsI["CaseNum"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: varCaseNum});
//inputsI["Comments"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: varComments});
inputsI["Comments"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: xlocation + " " + ylocation});
inputsI["SHAPE@XY"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingFeatures", { features: inputFeatures });
inputsI["classification"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: varClassification});
gpParametersInsert.inputs = inputsI;
// Create the job that handles the communication between the application and the geoprocessing task
insertCursorJob = insertCursorTask.createJob(gpParametersInsert);
//insertCursorJob.start();
... View more
10-04-2019
06:43 AM
|
0
|
20
|
1702
|
|
POST
|
It has to be on the QML side of things....If I manually enter data into the GP Service I published it works fine....its not until I push from AppStudio that it breaks....right now it just puts them off the coast of Africa....no matter what data I send to it.... I can change the XY to anything I want and it still puts them off Africa The Parameters seen below are all string except the X and Y I reviewed the links you sent and nothing stands out to me.... var varItem = "shooter";
var varPublicPrivate = "public";
var varCaseNum = "77";
var varComments = "comments jump jump up and get down";
var varClassification = "Boating";
var xlocation = -96.43153;
var ylocation = 39.527056;
var gpParametersInsert = ArcGISRuntimeEnvironment.createObject("GeoprocessingParameters",
{executionType: Enums.GeoprocessingExecutionTypeAsynchronousSubmit});
var inputsI = {};
inputsI["Item"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: varItem});
inputsI["PublicPrivate"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: varPublicPrivate});
inputsI["CaseNum"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: varCaseNum});
//inputsI["Comments"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: varComments});
inputsI["Comments"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: xlocation + " " + ylocation});
inputsI["SHAPE@X"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingDouble", {value: xlocation});
inputsI["SHAPE@Y"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingDouble", {value: ylocation});
inputsI["classification"] = ArcGISRuntimeEnvironment.createObject("GeoprocessingString", {value: varClassification});
//var inputresults = inputs;
gpParametersInsert.inputs = inputsI;
// Create the job that handles the communication between the application and the geoprocessing task
insertCursorJob = insertCursorTask.createJob(gpParametersInsert);
insertCursorJob.start(); Execution Type: esriExecutionTypeAsynchronous
Parameters:
Parameter: Item
Data Type: GPString
Display Name Item
Description: Item
Direction: esriGPParameterDirectionInput
Default Value:
Parameter Type: esriGPParameterTypeOptional
Category:
Parameter: PublicPrivate
Data Type: GPString
Display Name PublicPrivate
Description: PublicPrivate
Direction: esriGPParameterDirectionInput
Default Value:
Parameter Type: esriGPParameterTypeOptional
Category:
Parameter: CaseNum
Data Type: GPString
Display Name CaseNum
Description: PublicPrivate
Direction: esriGPParameterDirectionInput
Default Value:
Parameter Type: esriGPParameterTypeOptional
Category:
Parameter: Comments
Data Type: GPString
Display Name Comments
Description: Comments
Direction: esriGPParameterDirectionInput
Default Value:
Parameter Type: esriGPParameterTypeOptional
Category:
Parameter: SHAPE_X
Data Type: GPDouble
Display Name SHAPE@X
Description: SHAPE@X
Direction: esriGPParameterDirectionInput
Default Value:
Parameter Type: esriGPParameterTypeOptional
Category:
Parameter: SHAPE_Y
Data Type: GPDouble
Display Name SHAPE@Y
Description: SHAPE@Y
Direction: esriGPParameterDirectionInput
Default Value:
Parameter Type: esriGPParameterTypeOptional
Category:
Parameter: classification
Data Type: GPString
Display Name classification
Description: classification
Direction: esriGPParameterDirectionInput
Default Value:
Parameter Type: esriGPParameterTypeOptional
Category:
... View more
10-03-2019
01:47 PM
|
0
|
22
|
1702
|
|
POST
|
RESPONSE TO 2 of your replys... Hope you can help me out a bit here....trying to implement the 3 ideas you mentioned... not sure how to handle the: pointList pt in pointList assigning the point to the SHAPE@XY Is this close to what you were thinking import arcpy
from arcpy import env
import os
# Geting user input for project name, status, type, submital date and planner name
varXCoord = arcpy.GetParameter(0)
varYCoord = arcpy.GetParameter(1)
varClassification = arcpy.GetParameterAsText(2)
fc = 'xxDBO.xxx'
workspace = arcpy.env.workspace = r'C:\Users\xx\AppData\Roaming\ESRI\Desktop10.5\ArcCatalog\[email protected]'
# http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-classes/pointgeometry.htm
# A list of coordinate pairs
pointList = [[varXCoord,varYCoord ]]
# Create an empty Point object
point = arcpy.Point()
# A list to hold the PointGeometry objects
pointGeometryList = []
for pt in pointList:
point.X = pt[0]
point.Y = pt[1]
pointGeometry = arcpy.PointGeometry(point)
pointGeometryList.append(pointGeometry)
#?????????
varXYCoord = point
sr = arcpy.Describe(fc).spatialReference
arcpy.env.outputCoordinateSystem = sr
## Start an edit session. Must provide the workspace.
edit = arcpy.da.Editor(workspace)
## Edit session is started without an undo/redo stack for versioned data
## (for second argument, use False for unversioned data)
edit.startEditing(False, False)
## Start an edit operation
edit.startOperation()
row_values = [( varXYCoord , varClassification)]
print(row_values)
cursor = arcpy.da.InsertCursor(fc,['SHAPE@XY', 'Classification'])
for row in row_values:
cursor.insertRow(row)
del cursor
... View more
10-03-2019
12:45 PM
|
0
|
0
|
3854
|
|
POST
|
OK so it seems the only way I can run publish the python script to a service is if I give it an XY value. BUT then because I give it the value it makes this the default value.... 1. If I run from the Submit from the service it runs fine 2. If I run and call the GP Service from AppStudio it puts the new point at the same XY as the default no matter what. I seemingly cant overwrite the XY value that is defaulted in the service.
... View more
10-03-2019
11:23 AM
|
0
|
1
|
3854
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-20-2018 11:09 AM | |
| 1 | 09-10-2018 06:26 AM | |
| 1 | 09-15-2022 11:02 AM | |
| 1 | 05-21-2021 07:35 AM | |
| 1 | 08-09-2022 12:39 PM |
| Online Status |
Offline
|
| Date Last Visited |
09-19-2022
09:23 PM
|