get feature count and length of feature classes using C#

2876
3
Jump to solution
07-20-2014 06:45 AM
ababreddy
New Contributor

hi, i have transport File geodatabase and feature data set and feature class like roads,driveways,sidewalks and parking lots. my requirement is i need to get feature count and lentgth of all feature classes in the excel using C#.can any one help?

0 Kudos
1 Solution

Accepted Solutions
FreddieGibson
Occasional Contributor III

I'm going to assume that you're using ArcObjects .NET. If you're wanting to accomplish this task in C# you could do this using Geoprocessing. You could probably complete this entire process using the Summary Statistics tool. You would just need to get the SUM for the length field of the features and also utilize Count. This would create a table for each individual feature you need to process. You would then be able to aggregate all of the outputs into a single table.

If you wanted more fine grain control you could try using cursors in ArcObjects as well. You would utilize a Search Cursor to aggregate the data about each feature and you could use an InsertCursor to push the results to an output table that you've created.

On the other hand, the easiest way to accomplish this would be to use Python. The workflows would be the same as the ArcObjects workflow, but you'd see a decrease in development overhead. I don't believe you'd see too much of a performance difference between the two options.

View solution in original post

0 Kudos
3 Replies
TimothyHales
Esri Notable Contributor

I've moved your post into the ArcObjects SDK space. You will get a much better answer here as the GeoNet Help is intended for community help and feedback. You can see more on the community structure, and what topics are under each space from the following documents:

GeoNet Community Structure

ArcGIS Discussion Forums Migration Strategy

Thanks!

Timothy

0 Kudos
MirbazKhan_Ahmadzai
New Contributor
  1. Go to TOC Layer Attribute table
  2. Open table
  3. right click on lenght field
  4. click statistic

Look for sum, this is total sum of length

Note: this total length is just for one layer. do same process for another layer if you have
cheers,
Ahmadzai

0 Kudos
FreddieGibson
Occasional Contributor III

I'm going to assume that you're using ArcObjects .NET. If you're wanting to accomplish this task in C# you could do this using Geoprocessing. You could probably complete this entire process using the Summary Statistics tool. You would just need to get the SUM for the length field of the features and also utilize Count. This would create a table for each individual feature you need to process. You would then be able to aggregate all of the outputs into a single table.

If you wanted more fine grain control you could try using cursors in ArcObjects as well. You would utilize a Search Cursor to aggregate the data about each feature and you could use an InsertCursor to push the results to an output table that you've created.

On the other hand, the easiest way to accomplish this would be to use Python. The workflows would be the same as the ArcObjects workflow, but you'd see a decrease in development overhead. I don't believe you'd see too much of a performance difference between the two options.

0 Kudos