We are doing stereo aerial image interpretation in ImageAnalyst. Our stereo interpreter receives the following error message about every hour: A geodatabase exception has occurred. This happens in the following function, when executing featLayer.Search(queryFilter):
public static async Task<Feature> GetFeatureAsync(FeatureLayer featLayer, string whereClause)
{
try
{
Feature feature = await QueuedTask.Run(() =>
{
// Query the FC
QueryFilter queryFilter = new QueryFilter();
queryFilter.WhereClause = whereClause;
using RowCursor rowCursor = featLayer.Search(queryFilter);
if (rowCursor.MoveNext())
{
// Get feature
Row row = rowCursor.Current;
feature = row as Feature;
return feature;
}
return null;
});
return feature;
}
catch (Exception ex)
{
ProPopupMessage.Error(MiscUtils.GetMethodName(), ex.Message);
return null;
}
}
I would like to explain a bit in more detail what the stereo interpreter is doing. He is recording woody plant coverage in every square of a biotope object:
The workflow looks as follows:
I doublechecked, the objectID really exists when the error occurs. What could be the cause of the problem?
Should I try to search the feature class instead of the feature layer?
Solved! Go to Solution.
Yes — you should switch to searching on the FeatureClass instead of the FeatureLayer, as it's more robust and avoids rendering-related issues.
public static async Task<Feature> GetFeatureAsync(FeatureLayer featLayer, string whereClause)
{
try
{
Feature feature = await QueuedTask.Run(() =>
{
// Access the FeatureClass directly
FeatureClass featureClass = featLayer.GetFeatureClass();
if (featureClass == null)
return null;
QueryFilter queryFilter = new QueryFilter
{
WhereClause = whereClause
};
using (RowCursor rowCursor = featureClass.Search(queryFilter, false))
{
if (rowCursor.MoveNext())
{
return rowCursor.Current as Feature;
}
}
return null;
});
return feature;
}
catch (Exception ex)
{
return null;
}
}
Yes — you should switch to searching on the FeatureClass instead of the FeatureLayer, as it's more robust and avoids rendering-related issues.
public static async Task<Feature> GetFeatureAsync(FeatureLayer featLayer, string whereClause)
{
try
{
Feature feature = await QueuedTask.Run(() =>
{
// Access the FeatureClass directly
FeatureClass featureClass = featLayer.GetFeatureClass();
if (featureClass == null)
return null;
QueryFilter queryFilter = new QueryFilter
{
WhereClause = whereClause
};
using (RowCursor rowCursor = featureClass.Search(queryFilter, false))
{
if (rowCursor.MoveNext())
{
return rowCursor.Current as Feature;
}
}
return null;
});
return feature;
}
catch (Exception ex)
{
return null;
}
}
Thank you, I will do this! I will let you know in a couple of days if the stereo interpreter gets less errors.
Also, think about where on the network your Geodatabase is being saved. Recall that Geodatabases on OneDrive 'are not supported by ESRI'. The data transfer delay associated with OneDrive and other Cloude storage solutions dependent on network traffic (and any dropped packets) from your desk all the way to the server in (wherever that is at ;-).
Our geodatabase is a file geodatabase on a local disk.
I've talked to our stereo interpreter. The error now only occurs about once per day, not every hour.
Unfortunately, problem is not solved yet. The stereo interpreter is now working faster and the error appears about every hour. We have migrated the application from ArcGIS to ArcGIS Pro. We did exactly the same thing in ArcGIS, and there was no error!
What makes things worse, is the fact that after having restarted ArcGIS Pro after the error, the buttons in the ribbon only get activated after about 20 minutes. So as a workaround, we recreate the .aprx.
I think that this is a bug that has to be fixed by ESRI staff. I could solve this problem differently by creating a relationship between the square FC and the point FC instead of querying the point FC.
@BarbaraSchneider2 , I am not familiar with the migration or stereo components, but you can establish a relationship between the specific rows of the squareFC and the pointFC using the CreateRelationship method.