ThinkGeo.com    |     Documentation    |     Premium Support

SLOW Looping through Internal Features

I have a function that loops through a SpatialQueryFeatureLayer


About 4000 Features


Is there a way to speed it up? Im trying to Rebuild index



For Each myFeature In spatialQueryResultLayer.InternalFeatures()


                   AAA += CDbl(myFeature.ColumnValues("AAA"))

                    AA += CDbl(myFeature.ColumnValues("AA"))

                    A += CDbl(myFeature.ColumnValues("A"))

                    B += CDbl(myFeature.ColumnValues("B"))

                    C += CDbl(myFeature.ColumnValues("C"))

                    D += CDbl(myFeature.ColumnValues("D"))

                    Total += AAA + AA + A + B + C + D

                    myRecord += "" & myFeature.ColumnValues("MI_SQL_REC_NUM").ToString & ""

                    myRecord += " - "

                    myRecord += recAAA.ToString

                    myRecord += " - "

                    myRecord += recAA.ToString

                    myRecord += " - "

                    myRecord += recA.ToString

                    myRecord += " - "

                    myRecord += recB.ToString

                    myRecord += " - "

                    myRecord += recC.ToString

                    myRecord += " - "

                    myRecord += recD.ToString

                    myRecord += " - "

                    myRecord += "
"

                Catch ex As Exception



                End Try



            Next



Hi Gregory, 
  
 Thanks for your code. 
  
 What’s the class of your SpatialQueryFeatureLayer? 
  
 Is that an InMemoryFeatureLayer or a ShapeFileFeatureLayer? 
  
 If that’s a ShapeFileFeatureLayer I think that should be slow because it will read data from disk. You can try to build an InMemoryFeatureLayer and add all features to it then did spatial query on the InMemoryFeatureLayer, I think that will enhancement the performance. 
  
 Thanks 
  
 Don