AGSFeatureSet as parameter for AGSGeoprocessor

768
6
08-09-2010 04:25 PM
MarcoBrugna
New Contributor II
Hi everyone,

I'm trying to pass a AGSFeatureSet with a single point to an AGSGeoprocessor which takes as input a GPFeatureRecordSetLayer parameter:

NSMutableArray *features = [NSMutableArray array];
[features addObject:currentPoint];
 
AGSFeatureSet *fset = [[AGSFeatureSet alloc] init];
fset.features = features;
 
 
NSDictionary *params = [NSDictionary  dictionaryWithObjectsAndKeys:
       @"Input_Facilities",fset,
       nil];



but I receive the following error when I fill the Dictionary with the fset variable.

'*** -[AGSFeatureSet copyWithZone:]: unrecognized selector sent to instance 0x4e47270'


which means that the AGSFeatureSet doesn't support the NSCopying protocol.


What I missing o mistaking?

Thanks in advance for you help.

Marco
0 Kudos
6 Replies
HarikantJammi
New Contributor
NSDictionary *params = [NSDictionary  dictionaryWithObjectsAndKeys:
       @"Input_Facilities",fset,
       nil];
The above statement should be like this according to me

NSDictionary *params = [NSDictionary  dictionaryWithObjectsAndKeys:
       fset,@"Input_Facilities",
       nil];
0 Kudos
MarcoBrugna
New Contributor II
What a stupid error 😛
I was too tired.  Ty 😉


any way...

I'm trying to run a geoprocessor but I can't make it works.
After setting the parameters and submitting the job I don't get any message back.
No didSubmitJobWithId or jobDidFail or jobDidSucceed.

How can  I find the problem? is there a way to get the error message?

Here there is my code:
AGSGraphic *punto = [[AGSGraphic alloc] initWithGeometry:[[AGSPoint alloc] initWithX:1024282 y:5694813 spatialReference:sr]
               symbol:nil 
              attributes:[NSDictionary  dictionaryWithObjectsAndKeys:
                 @"1", @"ID",
                 nil] 
            infoTemplate:nil];
 
 NSMutableArray *features = [[NSMutableArray alloc] init];
 [features addObject:punto];
 
 AGSFeatureSet *fset = [[AGSFeatureSet alloc] initWithDisplayFieldName:@"ID" 
                 features:features 
                fieldAliases:nil 
               spatialReference:sr 
                geometryType:AGSGeometryPoint];

 NSDictionary *params = [NSDictionary  dictionaryWithObjectsAndKeys:
       @"1200", @"Drive_Time_Value",
       @"Length", @"Impedance_attribute",
       fset,@"Input_Facilities",
       @"TRAVEL_FROM",@"Travel_from_or_to_facility",
       @"NO_MERGE",@"Merge_polygons_with_similar_ranges",
       @"RINGS",@"Polygon_nest_option",
       @"ALLOW_UTURNS",@"U-turn_policy",
       @"Oneway",@"Restrictions",
       nil];
 
 
 
 
 // submit the job
 [agp  submitJobWithParameters:params];
 
 // cleanup alloc'd objects
 [sr release];
 [agp release];



thanks 🙂
Marco
0 Kudos
HarikantJammi
New Contributor
i think you have not set the delegate that's why you are not getting the event callbacks, put the below line in yur code before the query
agp.delegate = self ;
0 Kudos
MarcoBrugna
New Contributor II
i think you have not set the delegate that's why you are not getting the event callbacks, put the below line in yur code before the query
agp.delegate = self ;



I did it 😞
These are the lines before the code i've posted yesterday.

AGSGeoprocessor *agp = [[AGSGeoprocessor alloc] initWithURL:[NSURL URLWithString:kAsyncGPService]];
 agp.delegate = self;
 agp.interval = 5;



I think that the problem are the parameters in the Dictionary. But I don't know why. They are all GPString except the GPFeatureSetLayer for the point.
0 Kudos
NimeshJarecha
Esri Regular Contributor
If possible, can you please attach your sample application?

Regards,
Nimesh
0 Kudos
Sambasiva_RaoDodigam
New Contributor
Parameters is an array:

AGSGPParameterValue *parcel = [AGSGPParameterValue parameterWithName:@"Parcel_ID" type:AGSGPParameterTypeString value:@"1N1E34CC  -06600"];

AGSGPParameterValue *distance = [AGSGPParameterValue parameterWithName:@"SearchDistance_ft" type:AGSGPParameterTypeLong value:[NSNumber numberWithInt:100]];

NSArray *params = [NSArray arrayWithObjects:parcel,distance,nil];

Please have a look
http://help.arcgis.com/en/arcgismobile/10.0/apis/iOS/2.0/concepts/index.html#/Geoprocessor/00pw00000...
0 Kudos