AnsweredAssumed Answered

How to add a feature to a feature class from shape file?

Question asked by huangs3 on May 16, 2012
Latest reply on May 16, 2012 by geonetadmin
Hi Experts:

    Following is the code I wrote to add a point feature to a shape file.

//*********************************************************************
public static void AddToFeatureClass(IFeatureClass baseClass, IGeometry newGeometry)
{
    IFeature newFeature = baseClass.CreateFeature();
    newFeature.Shape = newGeometry;
    (newFeature.Shape as IZAware).ZAware = (newGeometry as IZAware).ZAware;
    (newFeature.Shape as IMAware).MAware = (newGeometry as IMAware).MAware;
}
//*********************************************************************

    The code could run through and add a record into the shape file. However, in ArcMap attribute table there is no response when I zoom/pan/flash the added point. When I idenfy the point I found that it has an undefined location (see the following screenshoot).

[ATTACH=CONFIG]14373[/ATTACH]

    When I use the Visual Studio debug mode to inspect the new feature, I couldn't find any issue.
[ATTACH=CONFIG]14374[/ATTACH]

    What does it happen? How shall I fix the issue? If more information is needed please let me know. Thank you.

Outcomes