Hello,
its urgent ...
i actually tried ways , even checked ESRI sample code QueryTaskExample. i need simply to get Fields Names or Attributes of any Layer .
i used following method...
self.queryTask = [AGSQueryTask queryTaskWithURL:[NSURLURLWithString:strMAPURL]]; // here i send like @"http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/3"
self.queryTask.delegate = self;
//return all fields in query
self.query = [AGSQuery query];
self.query.outFields = [NSArray arrayWithObjects:@"*", nil];
self.query.text = @"Fields"; // with out this line or without empty query it gives error
[self.queryTask executeWithQuery:self.query];
i access below delegates :
//results are returned
- (void)queryTask:(AGSQueryTask *)queryTask operation:(NSOperation *)op didExecuteWithFeatureSetResult:(AGSFeatureSet *)featureSet {
//get feature, and load in to table
self.featureSet = featureSet;
[super.tableView reloadData];
}
featureSet.fields // this should be giving me Name of Fields for Layer 3....
but i am getting Array as 0 elements...... i need to get Fields name in same order as there in Server Layer....
The fields in AGSFeatureSet is available only if the ArcGIS Server service is version 10.1 and above. Please refer help here. Are you using sample server service or your own service? If your own service then run query on the browser and make sure it returns `fields`. Please let me know so I can help you further.
Regards,
Nimesh
i tried with Server 10.3 , http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/2
but Fields only show 53 objects but each object shows 0 Key/value pair
fields is an array of AGSField objects. You will get name of the field from property. Actual, values are in the AGSGraphic's attributes.
Regards,
Nimesh