Tool GetCount does not return exact feature count

585
2
06-29-2020 01:30 AM
NguyenTuan
New Contributor

Hello everyone

I want to count features in a featureclass, and I found in the document that function GetCount can return the total number of rows for a table 

After runing this tool, it turned out that this function return maximum number of ObjectID, not feature count. If in the featureclass, there is a leap between ObjectID (i.e ObjectId is not continuous as in my case), the result wil not exact.

Does anyone have any ideas to solve this problem? or does ESRI have another function to do this?

Thank you

0 Kudos
2 Replies
by Anonymous User
Not applicable

Hello Nguyen,

You can use IFeatureClass.FeatureCount() method to get the number of features in a feature class - ArcObjects SDK.

Can you provide more information on the environment? Are you looking for ArcGIS Pro SDK?

If it is ArcGIS Pro SDK, then GetCount should work as per the documentation. Please refer the following link which might help you https://community.esri.com/thread/206446-how-can-i-get-the-feature-count-of-a-layer 

0 Kudos
NguyenTuan
New Contributor

Thank you, Ravi

I am running ArcGIS for Desktop 10.3. Actually, I am finding a geoprocessing tool to count features because of ArcObjects SDK license.

Do you have any recommend for me?

0 Kudos