Hello,
I have an ArcCatalog addin that is transfering data from an SDE database to a file geodatabase, and I am running into an issue trying to store geometry of copied features.
The feature classes copy over correctly (with the correct spatial reference), but when I try to assign the feature.Shape property and store, I get an HRESUT: 080010105 (RPC_E_SERVERFAULT) exception.
The problem method:
I cannot figure out exactly why I am unable to store any geometry. I thought it may be an edit session problem, however ArcCatalog addins do not have the editor extension available.
Any help is appreciated.
Thanks!
I have an ArcCatalog addin that is transfering data from an SDE database to a file geodatabase, and I am running into an issue trying to store geometry of copied features.
The feature classes copy over correctly (with the correct spatial reference), but when I try to assign the feature.Shape property and store, I get an HRESUT: 080010105 (RPC_E_SERVERFAULT) exception.
The problem method:
Code:
public static void CopyAttributes(this IFeatureClass fromFc, IFeatureClass toFc, IGeometry boundary = null)
{
var sf = new SpatialFilter();
sf.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
sf.Geometry = boundary;
var inFcCurs = fromFc.Search(sf, false);
var feat = inFcCurs.NextFeature();
while (feat != null)
{
var newFeat = toFc.CreateFeature();
newFeat.Shape = feat.ShapeCopy;
// CODE FAILS HERE
newFeat.Store();
feat.CopyAttributes(newFeat);
feat = inFcCurs.NextFeature();
}
Marshal.ReleaseComObject(inFcCurs);
}
Any help is appreciated.
Thanks!