clay@icsnews.com

Get list of features out of a route layer

Discussion created by clay@icsnews.com on Aug 13, 2010
Latest reply on Aug 16, 2010 by clay@icsnews.com
I have an existing route layer that I'm trying to get the individual lines out of. I'm trying to use a FeatureCursor to step through them, but it doesn't seem to be working correctly. Can someone tell me what I'm doing wrong?

Here is the code I'm currently implementing. It's probably wrong since it's been pieced together from various sources.

NATraversalResult tResult = naLayer.Context.Result as NATraversalResult;
INATraversalResultQuery tQuery = naLayer.Context.Result as INATraversalResultQuery;
ESRI.ArcGIS.Geodatabase.IFeatureClass featureClass = tQuery.get_FeatureClass(ESRI.ArcGIS.Geodatabase.esriNetworkElementType.esriNETEdge);
ESRI.ArcGIS.Carto.IFeatureLayer featureLayer = new ESRI.ArcGIS.Carto.FeatureLayer();
featureLayer.FeatureClass = featureClass;
IFeatureSelection featureSelection = featureLayer as IFeatureSelection;
ESRI.ArcGIS.Geodatabase.ISelectionSet selectionSet = featureSelection.SelectionSet;
ESRI.ArcGIS.Geodatabase.ICursor cursor; 
selectionSet.Search(null, false, out cursor);
ESRI.ArcGIS.Geodatabase.IFeatureCursor featureCursor = cursor as ESRI.ArcGIS.Geodatabase.IFeatureCursor;
ESRI.ArcGIS.Geodatabase.IFeature feature = featureCursor.NextFeature();

while (feature != null)
{

}

Outcomes