How to access a Feature Class rows without creating a feature layer or project item in ArcGIS Pro SDK?

1204
5
Jump to solution
11-08-2021 05:27 AM
Amadeus111
Occasional Contributor II

I need to read a field's values from a Feature Class specifically it is a Feature Class in an enterprise geodatabase. The values will be populated as a Search Box suggestion source. 

I can do that by creating a FeatureLayer via

LayerFactory.Instance.CreateFeatureLayer 

and using RowCursor

 using (ArcGIS.Core.Data.Table ProposedBoundariesTable = FLayer.GetTable())
{
   using (RowCursor rowCursor = ProposedBoundariesTable.Search())
   {
        //collect the information                        
   }
}

 

However, in some cases, I want end-users would be able to do make a quick search without creating a Feature Layer or project item. Is there a way to do that in ArcGIS Pro SDK?

 

0 Kudos
1 Solution

Accepted Solutions
Aashis
by Esri Contributor
Esri Contributor

@Amadeus111 Can you open the row cursor as below as described in snippets

// Open a featureClass (within a feature dataset or outside a feature dataset).
using (FeatureClass featureClass = geodatabase.OpenDataset<FeatureClass>("FeatureClassName")) 
 using (RowCursor rowCursor = featureClass .Search(new QueryFilter())){
}

 

View solution in original post

0 Kudos
5 Replies
Aashis
by Esri Contributor
Esri Contributor

@Amadeus111 Can you open the row cursor as below as described in snippets

// Open a featureClass (within a feature dataset or outside a feature dataset).
using (FeatureClass featureClass = geodatabase.OpenDataset<FeatureClass>("FeatureClassName")) 
 using (RowCursor rowCursor = featureClass .Search(new QueryFilter())){
}

 

0 Kudos
Amadeus111
Occasional Contributor II

@Aashis  Yes, I can. Thanks, I have been looking for this for a long time. 

0 Kudos
Wolf
by Esri Regular Contributor
Esri Regular Contributor

You can find documentation on how to open an enterprise geodatabase here:

ProConcepts Geodatabase · ArcGIS/arcgis-pro-sdk Wiki (github.com)

and documentation on how to access feature class data here:

ProConcepts Geodatabase · ArcGIS/arcgis-pro-sdk Wiki (github.com)

0 Kudos
Amadeus111
Occasional Contributor II

@Wolf  Thank you for your reply but those links are broken on my end. 

I used @Aashis link and worked fine. I appreciate your help though. 

https://github.com/Esri/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase#geodatabases-and-datastores

 

 

0 Kudos
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Glad you found a solution, sorry, my links pointed to a private repo, i fixed them.

0 Kudos