Have you tried executing this task from the browser through the REST endpoint? Do you get your expected outfields there?
Hi, The results from the REST endpoint on browser are exactly the same as I get through the code. Based on this link (http://support.esri.com/en/bugs/nimbus/TklNMDY2NzMx), I am assuming I need to set the input feature set's field definitions as shown in the code block below. Also, I have set all the possible parameters as possible. But, nothing has made any difference. All these are ignored in the output feature class.Code block: FeatureSet featureSet = new FeatureSet(graphicsToSerialize);
featureSet.Fields = metroFLI.Fields;
featureSet.GlobalIdFieldName = metroFLI.GlobalIdField;
featureSet.ObjectIdFieldName = metroFLI.ObjectIdField;
featureSet.DisplayFieldName = metroFLI.DisplayField;
FeatureSet clipFeatureSet = new FeatureSet(GetExtentAsPolygon(_InterfaceFeatureExtent));
Geoprocessor gpTask = new Geoprocessor("http://myarcgisserver/ArcGIS/rest/services/Geoprocess/GPServer/Clip");
gpTask.JobCompleted += new EventHandler<JobInfoEventArgs>(gpTask_JobCompleted);
gpTask.Failed += new EventHandler<TaskFailedEventArgs>(gpTask_Failed);
List<GPParameter> gpParameters = new List<GPParameter>();
gpParameters.Add(new GPFeatureRecordSetLayer("Input_Features", featureSet));
gpParameters.Add(new GPFeatureRecordSetLayer("Clip_Features", clipFeatureSet));
gpTask.ProcessSpatialReference = _Map.SpatialReference;
gpTask.OutputSpatialReference = _Map.SpatialReference;
gpTask.SubmitJobAsync(gpParameters);
Code block of Job_Completed event:
void gpTask_JobCompleted(object sender, JobInfoEventArgs e)
{
Geoprocessor gpTask = (Geoprocessor)sender as Geoprocessor;
gpTask.GetResultDataCompleted += new EventHandler<GPParameterEventArgs>(gpTask_GetResultDataCompleted);
gpTask.Failed += new EventHandler<TaskFailedEventArgs>(gpTaskGetResults_Failed);
gpTask.GetResultDataAsync(e.JobInfo.JobId, "Output_Feature_Class", e.UserState);
}
Code block of GetResultDataCompleted:
void gpTask_GetResultDataCompleted(object sender, GPParameterEventArgs e)
{
GPFeatureRecordSetLayer resultRecordSet = e.Parameter as GPFeatureRecordSetLayer;
FeatureSet resultFeatureSet = resultRecordSet.FeatureSet;
IList<Graphic> resultGraphics = resultFeatureSet.Features;
}
As I said in my previous post, each graphic in my resultGraphics has FID, shape.leng and shape.length as their only attributes ignoring the whole set of attributes that the input_features had. Any further pointers is highly appreciated.Thanks.