Editing features very slow

249
0
01-25-2022 08:12 PM
JoeMadrigal
New Contributor III

I'm looking for a way to save feature attributes a fast as possible.  The two methods I have tried are pretty slow.  I have a feature dataset in a geodatabase (also tried shapefile) that I am applying a spatial intersect and editing those features that fall in my polygon.  I have tried the EditOperation and also the Inspector shown below.  I'm editing (changing attributes) over 27,000 features.  The modifyoperation takes 10 minutes and the Inspector code takes 23 minutes, which both seem way to slow.  I'm doing this in release mode (debug mode takes way too long).

 

 

 

// Using Edit Operation
var modifyOp = new ArcGIS.Desktop.Editing.EditOperation();
modifyOp.Name = "my edit";

// Create an extent rectangle
SpatialQueryFilter spatialQueryFilter = new SpatialQueryFilter
{
    FilterGeometry = CreateDomainPolygon(X, Y, length),
    SpatialRelationship = SpatialRelationship.Intersects
};
using (RowCursor fCursor = pFClass.Search(spatialQueryFilter, false))
{
    while (fCursor.MoveNext())
    {
       using (Row row = fCursor.Current)
       {
            nameVal = (string)row.GetOriginalValue(nameIndex);
            modifyOp.Modify(row, "fieldName1", dict[nameVal]);
            modifyOp.Modify(row, "fieldName2", dict[nameVal]);
       }
    }
}
modifyOp.Execute();

// Inspector inside rowcursor (slower!)
using (Feature pFeature = (Feature)fCursor.Current)
{
    nameVal = (string)pFeature.GetOriginalValue(nameIndex);
    insp.Load(pLayer, pFeature.GetObjectID());
    insp["fieldName1"] = dict[nameVal];
    insp["fieldName2"] = dict[nameVal];
    insp.Apply();
}

 

 

 

 I am wanting to get these down to a minute if possible.  Is there a faster/better way to edit feature attributes?

0 Kudos
0 Replies