Select to view content in your preferred language

SchemaBuilder error with enterprise geodatabase

119
2
a week ago
Pierre-YvesCURTINOT
Occasional Contributor

Hi,

I wrote code that adds a field to a feature class using SchemaBuilder. It works correctly with a file geodatabase, but not with an enterprise geodatabase hosted on PostgreSQL. In that case, an error message is returned stating: "The Fields collection contained multiple geometry fields. (st_perimeter(shape)".

The error occurs regardless of the geometry storage mode (PostGIS or ST_Geometry).

    var featureClass = featureLayer.GetFeatureClass();

    using (var geodatabase = featureClass.GetDatastore() as Geodatabase)
    {
        var fcDefinition = featureClass.GetDefinition();
        var fcDescription = new FeatureClassDescription(fcDefinition);

        var fieldDescription = ArcGIS.Core.Data.DDL.FieldDescription.CreateStringField("NEW_FIELD", 50);
        var newFcDescription = new List<ArcGIS.Core.Data.DDL.FieldDescription>(fcDescription.FieldDescriptions);
        newFcDescription.Add(fieldDescription);

        FeatureClassDescription newDesc = new FeatureClassDescription(fcDescription.Name, newFcDescription, fcDescription.ShapeDescription);

        var schemaBuilder = new SchemaBuilder(geodatabase);
        schemaBuilder.Modify(newDesc);
        bool res = schemaBuilder.Build();

        if (res)
            MessageBox.Show("Field added");
        else
            MessageBox.Show(schemaBuilder.ErrorMessages.First().ToString());
    }

Is this a known issue or an expected behavior? Is there a different way of adding a field with the SDK when working with an enterprise geodatabase?

Thanks for your help.

0 Kudos
2 Replies
Aashis
by Esri Contributor
Esri Contributor

Which version of ArcGIS Pro are you using? I'd like to see if I can replicate the issue on our end.

0 Kudos
Pierre-YvesCURTINOT
Occasional Contributor

ArcGIS Pro version: 3.6.4   PostgreSQL version: 13.8

But I wonder if the problem might simply stem from a compatibility issue with the st_geometry library.

0 Kudos