The default value is unquoted:
Parameter: WATER_Depth Data Type: GPString Display Name WATER Depth Description: description Direction: esriGPParameterDirectionInput Default Value: 203.70 Parameter Type: esriGPParameterTypeRequired Category: Choice List: [ 47.85, 67.00, 95.75, 138.90, 203.70, 301.00, 447.05, 666.30, 995.55, 1500.85 ] |
When you submit empty parameters, it runs through ok.
I've actually just taken out the choice list altogether and republished it - we decided that as we're calling this service from our site, we can just set the allowed values into a dropdown on the web page.
UPDATE:
I've looked a bit further into this and something is definitely parsing the input, so even though the values are going into the GP service as strings, they have been rounded off.
I made a tool with the following script:
import arcpy
string_var1 = arcpy.GetParameterAsText(0)
string_var2 = arcpy.GetParameter(1)
double_var1 = arcpy.GetParameterAsText(2)
double_var2 = arcpy.GetParameter(3)
arcpy.AddMessage('String var 1 is a %s, value %s.' % (type(string_var1), string_var1))
arcpy.AddMessage('String var 2 is a %s, value %s.' % (type(string_var2), string_var2))
arcpy.AddMessage('Double var 1 is a %s, value %s.' % (type(double_var1), double_var1))
arcpy.AddMessage('Double var 2 is a %s, value %s.' % (type(double_var2), double_var2))
Then published it so the REST directory looks like:
Parameters: Parameter: string1 Data Type: GPString Display Name string1 Description: Direction: esriGPParameterDirectionInput Default Value: 10.100 Parameter Type: esriGPParameterTypeRequired Category: Parameter: string2 Data Type: GPString Display Name string2 Description: Direction: esriGPParameterDirectionInput Default Value: 10.100 Parameter Type: esriGPParameterTypeRequired Category: Parameter: double1 Data Type: GPDouble Display Name double1 Description: Direction: esriGPParameterDirectionInput Default Value: 10.1 Parameter Type: esriGPParameterTypeRequired Category: Parameter: double2 Data Type: GPDouble Display Name double2 Description: Direction: esriGPParameterDirectionInput Default Value: 10.1 Parameter Type: esriGPParameterTypeRequired Category: |
If you call it with no parameters (params = {}), it uses the defaults and the output is:
2015-07-16 11:41:45.093 core.js:186 String var 1 is a <type 'unicode'>, value 10.100. 2015-07-16 11:41:45.095 core.js:186 String var 2 is a <type 'unicode'>, value 10.100. 2015-07-16 11:41:45.097 core.js:195 Double var 1 is a <type 'unicode'>, value 10.1. 2015-07-16 11:41:45.099 core.js:195 Double var 2 is a <type 'float'>, value 10.1. |
But if you pass in some values, they are truncated:
| params = { |
| | "string1": "1.1200", |
| | "string2": "1.1200", |
| | "double1": 1.1200, |
| | "double2": 1.1200 |
| }; |
2015-07-16 11:38:33.552 core.js:199 String var 1 is a <type 'unicode'>, value 1.12. 2015-07-16 11:38:33.553 core.js:199 String var 2 is a <type 'unicode'>, value 1.12. 2015-07-16 11:38:33.555 core.js:199 Double var 1 is a <type 'unicode'>, value 1.12. 2015-07-16 11:38:33.556 core.js:199 Double var 2 is a <type 'float'>, value 1.12. |
I guess the answer is to alter the script to interpret the inputs as doubles, but it's annoying that something is being clever along the way and changing my values.