3

I have a pretty simple geoprocessing script. My javascript is supposed to be passing it a list of layers to query. Something like this for the Javascript:

var params = { "Layers": "foo,bar,hello,world"};
var gp = new Geoprocessor(*myURL*);
gp.submitJob(params, gpSuccess, gpStatus, gpFailed);

The Geoprocessor just explodes the list based on the comma, and reads the layers from the database. Pretty straight forward. I'm reading the inputs in as a text string, like so:

layers = GetParameterAsText(0)

My code works fine in my own testing, the problem is when I have this running as a service, I can't seem to pass it the correct values. It always runs based off the default values (which end up being whatever I supplied when I did my test run in Arc Catalog). I have "layers" defined as an input variable for the model, so I'm not sure why it's not getting my input. Checking the job status verifies that it is running off the default values, and not what I am attempting to supply as an argument.

The geoprocessing script can be accessed through the REST interface here.

The source code can be found here.

asked Feb 23, 2016 at 20:28
3
  • Are you able to post the entire geoprocessing script, and/or provide a link to the online service (myURL above)? Commented Feb 23, 2016 at 22:06
  • Sure, I'll do that ASAP but I'm afraid neither are particularly clean. Should be up tomorrow morning. Commented Feb 24, 2016 at 0:40
  • 2
    Added links to the public online service and the source code for the script. Both are probably sloppy. I regret nothing. Commented Feb 24, 2016 at 13:06

2 Answers 2

1

I created a new Geoprocessing service from the same script, available here (Yes, I'm extremely good at naming services). I didn't do anything different (I used all the same configuration settings) but it appears to be working correctly now. My guess is there was an issue with the settings, but I honestly have no clue what it could be.

I'm not going to accept this as an answer because while it worked it certainly doesn't explain how or why this problem occurred, but it might help others in a similar situation. Hopefully someone more knowledgeable can shed some light on this eventually.

answered Feb 24, 2016 at 16:14
1
  • 1
    error message haiku: yesterday it worked / today it isn't working / software is like that Commented Feb 24, 2016 at 21:41
0

I had a similar problem that my geoservice kept running with default value for one of service parameters. In my case, it takes two parameters: a string list (GPMultiValue:GPString) and a numeric value (GPLinearUnit). Here are their descriptions:

Parameter: ConfirmedCaseUIDList
Data Type: GPMultiValue:GPString
Display Name ConfirmedCaseUIDList
Description: Confirmed Case UID List
Direction: esriGPParameterDirectionInput
Default Value: [ 20032823330760 ]
Parameter Type: esriGPParameterTypeRequired
Category:
Parameter: SearchRadius
Data Type: GPLinearUnit
Display Name SearchRadius
Description: Search Radius
Direction: esriGPParameterDirectionInput
Default Value: 1.5 (esriMeters)
Parameter Type: esriGPParameterTypeRequired
Category:

And my codes are like:

var list = ["12345","67890"];
var dist = 3;
var params = {
 "ConfirmedCaseUIDList": list,
 "SearchRadius": {
 "distance": dist,
 "units": "esriMeters"
 }
 };
gp.submitJob(params).then(drawResultData, errBack, progTest);

The service did take the value I feed in for the string list parameter, but kept using the default value (here is 1.5) for the second parameter, whose data type was GPLinearUnit.

After long trying that didn't work with the problem, I changed its data type to GPDouble and my codes as follows:

Parameter: SearchRadius
Data Type: GPDouble
Display Name SearchRadius
Description: Search Radius
Direction: esriGPParameterDirectionInput
Default Value: 1.5
Parameter Type: esriGPParameterTypeRequired
Category:
var list = ["12345","67890"];
var dist = 3
var params = {
 "ConfirmedCaseUIDList": list,
 "SearchRadius": dist
};
gp.submitJob(params).then(drawResultData, errBack, progTest);

The problem was solved.

Kadir Şahbaz
78.6k57 gold badges260 silver badges407 bronze badges
answered Apr 4, 2020 at 22:28

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.