[GIS] Counting number of points in a point shapefile – ArcGIS 10.0 / arcpy

arcgis-10.0arcpy

I assumed this would be an easy thing to do. I'm loading a point shapefile into a map like this:

layer = arcpy.mapping.Layer(file_name)

Is there a way to get the number of points in the shapefile? I see using the 'Describe' command that I can get some info about things… For instance,

arcpy.Describe(layer).table.fields

Gives me some info about the fields in the underlying table but I can't count the rows.

Best Answer

Try int(arcpy.GetCount_management(layer).getOutput(0)): here's the documentation.

Related Question