Geoprocessor, featurelayer and itable

2518
3
07-08-2015 12:34 PM
GéomatiqueSopfeu
New Contributor

Hi ! Let see... In my arcGIS Engine 10 VB.NET 2010 application, I have a SDE grid layer that I want to join to an iTable (the iTable contains values that are in relation with the grid). I already have all the code in place that use geoprocessing to MakeTableView, CopyRows, AddIndex, AddJoin, CopyFeatures and RemoveJoin to finally create a SHP from a MDB personnel GDB and display the final result. It works well..... but it is sooo slow that my users still use an older VB6 graphic display software. I'm sure I'm doing something wrong... As we have arcGIS Server standard 10.1, tell me I'm out of the track and that something much better can be done to make y users happier... !!! Thanks... your help will be appreciated !!

0 Kudos
3 Replies
DuncanHornby
MVP Frequent Contributor

I think you need to upload the code if you want anyone to respond.  Someone may spot some way of speeding up the code?

0 Kudos
GéomatiqueSopfeu
New Contributor

Thanks Duncan... and you're right... so here is my code :

Sub ExportFeature(ByVal intWhat As Integer, ByVal pFC As IFeatureClass, ByVal pFL As IFeatureLayer, ByVal pTable As ITable)

        Dim GP As ESRI.ArcGIS.Geoprocessor.Geoprocessor = New ESRI.ArcGIS.Geoprocessor.Geoprocessor

        Dim strViewName As String = ""
        Dim strTableName As String = ""
        Dim strJoinedField As String = ""
        Dim strIndexName As String = ""


        Select Case intWhat
            Case 1 'TP/INT
                strViewName = "TPINTView"
                strTableName = "outTPINT"
                strJoinedField = "cell"
                strIndexName = "cell01"
        End Select

        frmModuleSIG.Cursor = Cursors.WaitCursor
        Dim pTableView As MakeTableView = New MakeTableView
        pTableView.in_table = pTable
        pTableView.out_view = strViewName
        RunTool(GP, pTableView, Nothing)

        frmModuleSIG.Cursor = Cursors.WaitCursor
        Dim pCopyRows As CopyRows = New CopyRows
        pCopyRows.in_rows = strViewName
        pCopyRows.out_table = frmModuleSIG.opAffMain.oLIP.Siif.RépertoireUsagerCitrix & "DonneesSIG\ModuleSIG.mdb\" & strTableName
        RunTool(GP, pCopyRows, Nothing)

        frmModuleSIG.Cursor = Cursors.WaitCursor
        Dim pAddIndex As AddIndex = New AddIndex
        pAddIndex.in_table = frmModuleSIG.opAffMain.oLIP.Siif.RépertoireUsagerCitrix & "DonneesSIG\ModuleSIG.mdb\" & strTableName
        pAddIndex.fields = strJoinedField
        pAddIndex.index_name = strIndexName
        pAddIndex.unique = True
        pAddIndex.ascending = True
        RunTool(GP, pAddIndex, Nothing)

        frmModuleSIG.Cursor = Cursors.WaitCursor
        Dim pjoinfeatures As AddJoin = New AddJoin
        pjoinfeatures.in_layer_or_view = pFL
        pjoinfeatures.in_field = strJoinedField
        pjoinfeatures.join_field = strJoinedField
        pjoinfeatures.join_table = frmModuleSIG.opAffMain.oLIP.Siif.RépertoireUsagerCitrix & "DonneesSIG\ModuleSIG.mdb\" & strTableName
        pjoinfeatures.join_type = False
        RunTool(GP, pjoinfeatures, Nothing)

        frmModuleSIG.Cursor = Cursors.WaitCursor
        Dim pcopyFeatures As CopyFeatures = New CopyFeatures
        If Not pFL Is Nothing Then
            pcopyFeatures.in_features = pFL
            pcopyFeatures.out_feature_class = frmModuleSIG.opAffMain.oLIP.Siif.RépertoireUsagerCitrix & "DonneesSIG\" & strTableName & ".shp"
            RunTool(GP, pcopyFeatures, Nothing)
        End If

        frmModuleSIG.Cursor = Cursors.WaitCursor
        Dim pRemoveJoin As RemoveJoin = New RemoveJoin
        pRemoveJoin.in_layer_or_view = pFL
        pRemoveJoin.join_name = strTableName
        RunTool(GP, pRemoveJoin, Nothing)

        frmModuleSIG.Cursor = Cursors.WaitCursor
        Dim pdelete As Delete = New Delete
        pdelete.in_data = frmModuleSIG.opAffMain.oLIP.Siif.RépertoireUsagerCitrix & "DonneesSIG\ModuleSIG.mdb\" & strTableName
        RunTool(GP, pdelete, Nothing)

        System.Runtime.InteropServices.Marshal.ReleaseComObject(pFC)
        System.Runtime.InteropServices.Marshal.ReleaseComObject(pFL)

        GC.Collect()
end sub

The IFeatureClass is my grid layer wich is a big canvas of the territory splitted in small cells.

My iTable may contains up to 22 000 data.

Thanks again !

0 Kudos
DuncanHornby
MVP Frequent Contributor

Looking at your code I can't see anything obvious but you do mention SDE so a quick look on GeoNet threw up this thread, worth a look. There is also a useful thread on GIS SE.

0 Kudos