Hi Everyone,
I am trying to use a feature layer description to create an identical new feature class with different fields. I know there are several ways to do this. I tried doing it on DLL. The feature class and fields I want is created correctly, but when I import it into the map, the feature layer does not show, because the shape area, length and polygon fields were not transferred to the new feature class. How can I fix this?
QueuedTask.Run(() =>
{
var LayerDef = Layer.GetFeatureClass().GetDefinition();
using (Geodatabase geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(gdb))))
{
// Creating the attribute fields
FieldDescription objectIDFieldDescription = FieldDescription.CreateObjectIDField();
FieldDescription field1 = new FieldDescription("field1", FieldType.Double);
FieldDescription field2 = new FieldDescription("field2", FieldType.Double);
List<FieldDescription> fieldDescriptions = new List<FieldDescription>()
{objectIDFieldDescription, field1, field2
};
ShapeDescription shapeDescription = new ShapeDescription(IntersectSort.GetFeatureClass().GetDefinition());
FeatureClassDescription LayerDescription = new FeatureClassDescription("Layer_Name", fieldDescriptions, shapeDescription);
SchemaBuilder schemaBuilder = new SchemaBuilder(geodatabase);
schemaBuilder.Create(LayerDescription);
bool success = schemaBuilder.Build();
});