<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ArcMap 10.1 Slow Performance with VB.NET Code (Spatial Query) in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/arcmap-10-1-slow-performance-with-vb-net-code/m-p/1017640#M43000</link>
    <description>&lt;P&gt;Additionally, and after investigation, when we change the esriSelectionResultEnum from "Add to Selection" to"New", the performance increased 6 times (~1min). Thus, to narrow down the perfromance issue, it seems related to "Add to selection" option. However, the query requires this option.&amp;nbsp; Any Advise!&lt;/P&gt;</description>
    <pubDate>Mon, 18 Jan 2021 10:17:13 GMT</pubDate>
    <dc:creator>dgesridgesri</dc:creator>
    <dc:date>2021-01-18T10:17:13Z</dc:date>
    <item>
      <title>ArcMap 10.1 Slow Performance with VB.NET Code (Spatial Query)</title>
      <link>https://community.esri.com/t5/data-management-questions/arcmap-10-1-slow-performance-with-vb-net-code/m-p/1017193#M42990</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have just installed ArcGIS 10.1 and MS Visual Studio 10 to develop automation tools for select by attribute and select by Location.&lt;BR /&gt;&lt;BR /&gt;We developed a new add-in button in ArcMAP, and clicking it should do 4 queries, 2 of them are&amp;nbsp; attribute&amp;nbsp;queries and other 2 are spatial queries. order (1 attribute, 1 spatial, 1 attribute, 1 spatial)&lt;/P&gt;&lt;P&gt;Suffering from very slow performance when using our code to perform the spatial queries.&lt;/P&gt;&lt;P&gt;Please help!!&lt;/P&gt;&lt;P&gt;Here after is the used code:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Public Function p_GenSelectByLocation(ByVal SourceLayerName As String, ByVal TargetLayerName As String, ByVal Whereclause As String, ByVal SelectionType As esriSelectionResultEnum, ByVal RelationType As esriSpatialRelEnum) As Integer
        Try
            Dim pboolSrcFound As Boolean = False
            Dim pboolTrgtFound As Boolean = False
            Dim pEnumLayer As IEnumLayer = My.ArcMap.Document.ActiveView.FocusMap.Layers(Nothing, True)
            Dim pSrcFLayer As IFeatureLayer = Nothing
            Dim pTrgtFLayer As IFeatureLayer = Nothing
            Dim pLoopLayer As ILayer = pEnumLayer.Next()


            pEnumLayer.Reset()
            Do Until pLoopLayer Is Nothing
                If TypeOf pLoopLayer Is IFeatureLayer Then
                    If pLoopLayer.Name = SourceLayerName Then
                        pSrcFLayer = pLoopLayer
                        pboolSrcFound = True
                    End If

                    If pLoopLayer.Name = TargetLayerName Then
                        pTrgtFLayer = pLoopLayer
                        pboolTrgtFound = True
                    End If
                End If
                If pboolSrcFound = True And pboolTrgtFound = True Then Exit Do
                pLoopLayer = pEnumLayer.Next()
            Loop
            If pSrcFLayer Is Nothing Or pTrgtFLayer Is Nothing Then Exit Try

            Dim pSrcFeatureSelection As IFeatureSelection = pSrcFLayer
            Dim pGeomToUnion As IGeometryCollection = New GeometryBag()

            If pSrcFeatureSelection.SelectionSet.Count = 0 Then Exit Try

            'Get union of Geometry of all selected features
            Dim pCursor As ICursor = Nothing
            pSrcFeatureSelection.SelectionSet.Search(Nothing, False, pCursor)

            If pCursor Is Nothing Then Exit Try
            Dim pfeatureCursor As IFeatureCursor = pCursor

            Dim pFeature As IFeature = pfeatureCursor.NextFeature
            Dim pGeometry As IGeometry
            pGeometry = pFeature.Shape

            Dim pCount As Integer = 0
            Do Until pFeature Is Nothing
                pCount += 1
                pGeometry = pFeature.Shape
                pGeomToUnion.AddGeometry(pGeometry)
                pFeature = pfeatureCursor.NextFeature
            Loop

            Dim pEnumGeometry As IEnumGeometry = pGeomToUnion
            'Dim pgeometrybag As IGeometryBag = pEnumGeometry

            Dim pResultGeom As ITopologicalOperator = Nothing
            If pGeometry.GeometryType = esriGeometryType.esriGeometryPolyline Then
                pResultGeom = New Polyline
                pResultGeom.ConstructUnion(pEnumGeometry)
            ElseIf pGeometry.GeometryType = esriGeometryType.esriGeometryPolygon Then
                pResultGeom = New Polygon
                pResultGeom.ConstructUnion(pEnumGeometry)
            End If

            If pResultGeom Is Nothing Then Exit Try

            'define the spatial filter and select the features based on the union Geometry
            Dim pSFilter As ISpatialFilter = New SpatialFilter


            'If pTrgtFLayer Is Nothing Then Exit Try
            Dim pnameOfShapeField As System.String = pTrgtFLayer.FeatureClass.ShapeFieldName
            pSFilter.GeometryField = pnameOfShapeField
            pSFilter.Geometry = TryCast(pResultGeom, IGeometry)
            pSFilter.SpatialRel = RelationType

            Dim pTrgtFeatureSelection As IFeatureSelection = pTrgtFLayer
            pTrgtFeatureSelection.SelectFeatures(TryCast(pSFilter, ESRI.ArcGIS.Geodatabase.ISpatialFilter), SelectionType, False)

            Return pTrgtFeatureSelection.SelectionSet.Count

        Catch ex As Exception
            pFuncReturnDebug(ex)
            Return -1
        End Try
    End Function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2021 10:39:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/arcmap-10-1-slow-performance-with-vb-net-code/m-p/1017193#M42990</guid>
      <dc:creator>dgesridgesri</dc:creator>
      <dc:date>2021-01-15T10:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: ArcMap 10.1 Slow Performance with VB.NET Code (Spatial Query)</title>
      <link>https://community.esri.com/t5/data-management-questions/arcmap-10-1-slow-performance-with-vb-net-code/m-p/1017285#M42992</link>
      <description>&lt;P&gt;ArcGIS 10.1 was retired from support over three years ago.&amp;nbsp; The current release is 10.8.1.&lt;/P&gt;&lt;P&gt;Your issue may be release independent, but there's really no way to tell, since you haven't mentioned data format, indexing, data volume, or actual timing (in seconds).&lt;/P&gt;&lt;P&gt;Please help us to help you by including enough details to make an answer possible.&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2021 17:13:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/arcmap-10-1-slow-performance-with-vb-net-code/m-p/1017285#M42992</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2021-01-15T17:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: ArcMap 10.1 Slow Performance with VB.NET Code (Spatial Query)</title>
      <link>https://community.esri.com/t5/data-management-questions/arcmap-10-1-slow-performance-with-vb-net-code/m-p/1017458#M42996</link>
      <description>&lt;P&gt;Thank you for replying, hereafter are the details: we are using FGDB data, the Target Layer includes 700,000+ features, and the Source Layer includes 200,000+ features. using the "Select by Location" built-in tool in ArcMap takes ~1.5 mins; however, using the code we have provided above takes ~6.5 mins. After Debugging,&amp;nbsp; more than 5.5 mins is delayed in the following line of code:&amp;nbsp; &lt;STRONG&gt;&lt;EM&gt;pTrgtFeatureSelection.SelectFeatures(TryCast(pSFilter, ESRI.ArcGIS.Geodatabase.ISpatialFilter), SelectionType, False)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;it is very critical performance issue, and I need to select the features in that layer in order to perform additional queries (attributes &amp;amp; spatial).&lt;/P&gt;&lt;P&gt;We are also trying to find another way/method than "&lt;STRONG&gt;&lt;EM&gt;SelectFeatures&lt;/EM&gt;&lt;/STRONG&gt;" to select the features in the Target layer, however still not sure if there is.&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Jan 2021 11:41:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/arcmap-10-1-slow-performance-with-vb-net-code/m-p/1017458#M42996</guid>
      <dc:creator>dgesridgesri</dc:creator>
      <dc:date>2021-01-16T11:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: ArcMap 10.1 Slow Performance with VB.NET Code (Spatial Query)</title>
      <link>https://community.esri.com/t5/data-management-questions/arcmap-10-1-slow-performance-with-vb-net-code/m-p/1017640#M43000</link>
      <description>&lt;P&gt;Additionally, and after investigation, when we change the esriSelectionResultEnum from "Add to Selection" to"New", the performance increased 6 times (~1min). Thus, to narrow down the perfromance issue, it seems related to "Add to selection" option. However, the query requires this option.&amp;nbsp; Any Advise!&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 10:17:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/arcmap-10-1-slow-performance-with-vb-net-code/m-p/1017640#M43000</guid>
      <dc:creator>dgesridgesri</dc:creator>
      <dc:date>2021-01-18T10:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: ArcMap 10.1 Slow Performance with VB.NET Code (Spatial Query)</title>
      <link>https://community.esri.com/t5/data-management-questions/arcmap-10-1-slow-performance-with-vb-net-code/m-p/1019217#M43006</link>
      <description>&lt;P&gt;Low hanging fruit on file&amp;nbsp; geodatabase query performance includes:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Making sure the dataset is on a local device (not a network-mounted drive)&lt;/LI&gt;&lt;LI&gt;Periodically rebuilding the spatial index&lt;/LI&gt;&lt;LI&gt;Building attribute indexes to cover query terms&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Spatial queries on badly fragmented datasets can also take a long time, even with a fresh spatial index.&amp;nbsp; I use relational databases, not file geodatabase, to juggle tens to hundreds of millions of rows, and I always make sure my data is physically organized&amp;nbsp; from left to right and top to bottom in chunks (e.g., countries by UTM Zone and MGRS tile; counties by state, from west to east). The&amp;nbsp; same physical ordering options are available for file geodatabase as enterprise, but they're rarely as necessary in the smaller table sizes (under 100-200k rows).&lt;/P&gt;&lt;P&gt;Tech Support can be of use with modern software, but when using something ancient you'd need to test against something modern to see if it's already been addressed.&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 18:44:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/arcmap-10-1-slow-performance-with-vb-net-code/m-p/1019217#M43006</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2021-01-22T18:44:22Z</dc:date>
    </item>
  </channel>
</rss>

