Hi, I am trying to update a field with different values for each row in a feature class. I have already found a solution, but the performance is pretty slow for feature classes containing more than 10.000 Features. For instance, in a feature class with 100.000 features it may take approximately 3 minutes.
For the time being I am using a cursor obtained by calling the search function in the FeatureClass object.
using (Geodatabase geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(fgdbPath))))
{
using (FeatureClass table = geodatabase.OpenDataset<FeatureClass>(fcName))
{
var cursor = table.Search(new QueryFilter()
{
SubFields = "OBJECTID, field"
}, false);
while (cursor.MoveNext())
{
var row = cursor.Current;
row["field"] = dictionary[(long) row["OBJECTID"]];
row.Store();
}
}
}
Is there an alternative to update a field faster than Cursor or perhaps I am missing something in the way I use the cursor?.
I also tried running the geoprocess Join Field which runs way faster than using the cursor, but in that case an intermediate table must be created in first place and later replace the new field for the old field.
Any suggestion is welcome. Thanks!