Select to view content in your preferred language

Speed up OpenDataset

443
1
04-01-2024 06:11 AM
EricPfirman
Occasional Contributor

I am migrating an Add-In from ArcMap to ArcGIS Pro. I have a file geodatabase with 1 feature dataset with 63 feature classes. I need to search through all feature classes in the feature dataset checking for REACH_GUID IS NULL and return a list of OBJECTIDs for each feature class. It takes 60 seconds in ArcGIS Pro vs 30 seconds in ArcMap. Is there any way to speed this up?

 

Dim irolFCD As IReadOnlyList(Of FeatureClassDefinition) = cls.gdb.GetDefinitions(Of FeatureClassDefinition)()
For Each fcd As FeatureClassDefinition In irolFCD
	Dim layerName As String = fcd.GetName()
	If fcd.FindField("Reach_Guid") <> -1 Then
		Dim tblLayer As Table = cls.gdb.OpenDataset(Of Table)(layerName)
		Dim qf As QueryFilter = New QueryFilter()
		qf.WhereClause = "REACH_GUID IS NULL"
		Dim rc As RowCursor = tblLayer.Search(qf, False)
		Dim l As List(Of Integer) = New List(Of Integer)
		While rc.MoveNext
			l.Add(CType(rc.Current("OBJECTID"), Integer))
			' Add layerName, OBJECTID to list
		End While
		If l.Count > 0 Then
			dctFC.Add(layerName, l)
		End If

	End If
Next
0 Kudos
1 Reply
Aashis
by Esri Contributor
Esri Contributor

How about using the recycling cursor during the search as below?

        Dim rc As RowCursor = tblLayer.Search(qf, True)

The recycling cursors offer performance advantages by allocating a single row object and rehydrating it on each fetch of reading data. They can be used to optimize read-only access.

 
 

 

0 Kudos