s26761

Problem to show feature layer in map

Discussion created by s26761 on Jun 25, 2011
Latest reply on Jun 27, 2011 by agray1
Hi All

I've created an app that accesses ArcMap via Desktop Automation to perform Network Analysis. Created a feature layer to show results from the Network Analysis - please refer to the code below. Checked that there are 'edges' features in the feature class. New feature layer is added to the TOC but the features are not displayed in the map. Any idea what maybe the problem?

Thanks.

Best Regards
CF

    Private Sub CheckNATraversalResult()
        Dim result As INAResult = m_pNAContextRS.Result
        Dim naTraversalResultQuery As INATraversalResultQuery = TryCast(result, ESRI.ArcGIS.NetworkAnalyst.INATraversalResultQuery)
        Dim featureClass As IFeatureClass = naTraversalResultQuery.FeatureClass(ESRI.ArcGIS.Geodatabase.esriNetworkElementType.esriNETEdge)
        Dim featureCursor As IFeatureCursor = featureClass.Search(Nothing, False)
        Dim feature As IFeature = featureCursor.NextFeature
        Do Until feature Is Nothing
            Debug.WriteLine("CheckNATraversalResult: " + featureClass.AliasName)
            Debug.WriteLine("IsEmpty: " + CStr(feature.Shape.IsEmpty))
            Debug.WriteLine("GeometryType: " + CStr(feature.Shape.GeometryType))
            feature = featureCursor.NextFeature
        Loop

        Dim featureLayer As IFeatureLayer = DirectCast(m_objFactory.Create("esriCarto.FeatureLayer"), IFeatureLayer)
        featureLayer.FeatureClass = featureClass
        featureLayer.Name = featureClass.AliasName
        AddLayer(featureLayer)
End Sub

Outcomes