I am working in ArcMap. I have a feature class layer (polyline) that has points in it. For each point, I want to cast/convert it to a geometry and place it in a separate layers attribute table; under the shape field column.
I also try and do other calculations on Shape field column in the table (such as a distance between points) and I get an error saying "The operation was attempted on an empty geometry.". This leads me to believe that I am not inserting the value into the table correctly. Furthermore, it leads me to believe I am not casting correctly or creating the IGeometry variable correctly either.
Also, when I try and look at the attribute table, it shows PointZM in the 'Shape' field column, however, when looking at the map, I cant see any points in Arcmap. My code is below.
IFeatureLayer _SelectedLayer = MultiItemList._CapturedFeatureLayer;
IFeatureClass _SelectedFeatClass = _SelectedLayer.FeatureClass;
IDataset _SelectedFeatureDataset = (IDataset)_SelectedFeatClass;
IWorkspace _SelectedWorkspace = (IWorkspace)_SelectedFeatureDataset.Workspace;
string _SelectedPath = _SelectedWorkspace.PathName;
IFeature _mySelectedFeature = _SelectedFeatClass.GetFeature(0);
IGeometry _theGeometry = _mySelectedFeature.Shape as IGeometry;
IPolyline _PolyLine = (IPolyline)_theGeometry;
IPointCollection _pointsCollection = (IPointCollection)_PolyLine;
if (_pointsCollection.PointCount>=2)
{
IEnumVertex2 _enumVertex = _pointsCollection.EnumVertices as IEnumVertex2;
IPoint _queryVertex = new PointClass();
_enumVertex.Reset();
IPoint _outVertex;
int partIndex;
int vertexIndex;
_enumVertex.Next(out _outVertex, out partIndex, out vertexIndex);
while (_outVertex != null)
{
ITable LeveePointsTable = (ITable)LeveePoints_featureClass;
int ShapeIndex = LeveePointsTasble.FindField("Shape");
IRow LeveePointsRow = LeveePointsTable.CreateRow();
// trying to cast IPoint to IGeometry
IGeomerty _myPoints = (Igeometry)_outVertex
LeveePointsRow.set_Value(ShapeIndex, _MyPoints);
}
}
Any help on this topic would be greatly appreciated. Thanks in advance.