Create output FeatureClass from IGPSchema

09-01-2017 08:22 AM
Regular Contributor

Could anyone kindly let me know how I can create a new FeatureClass as output from the IGPParameter. I have a requirement where I need to output a feature class with geometries. They are calcuated based on input ids. The source for the data is not part of the Input parameters.

From what I have looked into so far IGPParameter3 has a property for "Schema" which can be used to define a complete structure for the output. Below is the code I have in the ParameterInfo property.

public IArray ParameterInfo
     var targetFeatureClass = (IGPParameterEdit3)CreateParameter(
          "Target Points FeatureClass",
          (IGPDataType)new DEFeatureClassTypeClass(),
          new DEFeatureClassClass(),
     // Feature type, geometry type, and fields all come from the first dependent—the input features.
     IGPFeatureSchema outSchema = new GPFeatureSchemaClass();
     outSchema.FeatureType = esriFeatureType.esriFTSimple;
     outSchema.GeometryType = ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint;
     IFieldsEdit fieldsEdit = new FieldsClass();
     IFieldEdit fieldEdit = new FieldClass();
     fieldEdit.Name_2 = "ID2";
     fieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
     // Add the additional field to the derived output.
     IFields fields = fieldsEdit as IFields;
     outSchema.AdditionalFields = fields;
     targetFeatureClass.Schema = (IGPSchema)outSchema;

Can anyone let me know who I can use the above information to create a new FeatureClass within the Execute method. There is no dependency and I cannot use clone method.

0 Kudos
1 Reply
Regular Contributor

jayanta.poddar‌, khutchins-esristaff‌ any help or insight would be appreciated.

0 Kudos