jlaura

Generate Near Table Parameters

Discussion created by jlaura on May 28, 2013
I am using VB.NET and the assembly access method to generate a near table as a component of a larger tool.

When I pass both the near_table and near_features parameter the same FeatureLayer the tool fails with error 99999.  If run the tool via ArcMap or hardcode the near_features parameter with the full path the tool runs flawlessly. 

Is it necessary to open the featurelayer twice?  Via a new workspace? 

(New ArcObjects programmer here...)

Thanks

 Private Sub generateNearTable(ByVal distlayer, ByVal knn, ByVal DistanceTableOut)
        'Setup the geoprocessor
        Dim gp As New ESRI.ArcGIS.Geoprocessor.Geoprocessor

        Dim FeatureLayer = GetFLayerByName(distlayer)
        Dim NearFeatureLayer = GetFLayerByName(distlayer)

        'Setup Params
        Dim lcount As Long = knn

        'Get the generate near table tool
        Dim genneartable As GenerateNearTable = New GenerateNearTable()

        'Setup the Gp Environment
        Dim addtomap As Boolean = gp.AddOutputsToMap
        gp.TemporaryMapLayers = False
        gp.AddOutputsToMap = True 'Add the derived table to the map doc.
        gp.OverwriteOutput = True

        'Set Params
        genneartable.in_features = FeatureLayer
        genneartable.near_features = "C:\Users\jlaura\Desktop\TestData\Test_Points.shp"
        genneartable.out_table = DistanceTableOut
        genneartable.closest = False
        genneartable.closest_count = lcount 'This should be a parameter

        'Execute
        Try
            gp.Execute(genneartable, Nothing)
        Catch ex As Exception

        End Try

    End Sub

Outcomes