Hello,
I have a server GP tool that runs well from the web REST interface as well as through JavaScript on another page. However, I cannot get the iOS version to work. The GP tool takes about 6 seconds to run, so I believe I need it to be asynchronous. Here is my code:
// Build geoprocessor
AGSGeoprocessor* geoprocessor = [AGSGeoprocessor geoprocessorWithURL:gpURL];
geoprocessor.delegate = self;
// Geoprocessor build parameters
AGSGPParameterValue *pointX = [AGSGPParameterValue parameterWithName:@Point_X type:AGSGPParameterTypeDouble value:[NSNumber numberWithDouble:self.wgsPoint.x]];
AGSGPParameterValue *pointY = [AGSGPParameterValue parameterWithName:@Point_Y type:AGSGPParameterTypeDouble value:[NSNumber numberWithDouble:self.wgsPoint.y]];
AGSGPParameterValue *tile = [AGSGPParameterValue parameterWithName:@File_Name type:AGSGPParameterTypeString value:fullTileName];
// GP Parameters to array
NSArray *params = [NSArray arrayWithObjects:pointX, pointY,tile, nil];
//Run GP tool with asych delay
geoprocessor.interval = 10;
[geoprocessor submitJobWithParameters:params];
}
//this is the delegate method that gets called when job completes successfully
- (void)geoprocessor:(AGSGeoprocessor *)geoprocessor operation:(NSOperation *)op didSubmitJob:(AGSGPJobInfo *)jobInfo {
NSLog(@Geoprocessing Job Submitted!);
}
//this is the delegate method that gets called when gp job completes successfully.
- (void)geoprocessor:(AGSGeoprocessor *) geoprocessor operation:(NSOperation *) op jobDidSucceed:(AGSGPJobInfo *) jobInfo {
NSLog(@Geoprocessing Job Succeeded!);
}
- (void)geoprocessor:(AGSGeoprocessor *) geoprocessor operation:(NSOperation *) op jobDidFail:(AGSGPJobInfo *) jobInfo {
NSLog(@Geoprocessing Job Failed!);
}
The query usually returns something like this:
{
"results": [
{
"paramName": "Solar_Value",
"dataType": "GPString",
"value": "21865.1328496\n39619.3044974\n84117.1905997\n126159.758433\n167013.891821\n175695.394165\n174199.414434\n143438.383851\n97395.6361771\n51997.4207866\n25002.0289475\n16517.4218279\n"
},
{
"paramName": "Solar_Hours",
"dataType": "GPString",
"value": "271.56088993\n278.722662602\n356.971440711\n391.0648334\n448.550531915\n458.714285714\n457.440909091\n422.655603938\n370.273648649\n313.029113248\n271.510752688\n258.134615385\n"
}
],
"messages": []
}
However, I can't get any of the delegates to fire. What am I doing incorrectly? Is there a better way to implement this?
Thank you so much for any help you can provide. I've been running into a wall with this for a week now.