Counting number of features in workspace

Discussion created by jrs91 on Oct 27, 2013
Hello All,

I am attempting to count the number of features by shapeType in my workspace. I am able to print the name and Shape Type, but am unable to count the number of features by type. I have attempted to add a counter, but am such a newbie and I'm doing the counter wrong. It's always 0 for all features after the for loop. Thank you for your help.

5 MINUTES LATER UPDATE: I figured it out. I only had "counter + 1" instead of "counter =  counter +1". Brain lapse. The following edited script works now. I figure I will leave it here in case it's helpful to anyone.

(indents not included)

import arcpy
from arcpy import env
env.workspace = "[directory]"
fcs = arcpy.ListFeatureClasses()
Plinecount = 0
Pgoncount = 0
pointcount = 0
for fc in fcs:
    fcdescribe = arcpy.Describe(fc)
    if fcdescribe.shapeType == "Polyline":
        Plinecount = Plinecount +1
    if fcdescribe.shapeType == "Polygon" :
        Pgoncount = Pgoncount +1
    if fcdescribe.shapeType == "Point" :
        pointcount = pointcount +1
    print "Name: " + fcdescribe.name
    print "Shape type: " + fcdescribe.shapeType
print Plinecount
print Pgoncount
print pointcount

(everything but last three prints inside for loop)