Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Is it any way to remove input features that don't have any record ? ( In Batch Mode)

enter image description here

share|improve this question
add comment

2 Answers 2

I think it might be easier to just use the Select tool to keep records that do have values.

share|improve this answer
    
i don't want to delete records. i want to delete layer that don't have any record. imagine that we use clip tool to cut the area from target layer and there isn't any feature on that area , then the output layer wont have any records. i want to develop a tool to delete all empty layers on output folder by using Iteration. this is what i need. –  hvaezi Sep 19 '11 at 7:15
    
Would you be able to edit your question and expand upon it, please? For example, Get Count seems like a tool which should be used because it will return how many features are in a feature class. If 0, then you should be able to Delete the feature class based on that result. However, you have a Calculate Value tool in there, and I'm unclear of its purpose without more context. Also, rather than Iterate Multi-value I thought I would have seen an Iterate Feature Classes. –  PolyGeo Sep 19 '11 at 10:25
add comment

This python snippet will delete empty feature classes:

for fc in fcs:
    # print 'Processing ', fc
    count = arcpy.GetCount_management(fc)
    if count [0] == '0':
        arcpy.Delete_management(fc)
        removed = '\t==> removed'
    else:
        removed = ' '
    print '%s records in %s %s' % ('{0:>9}'.format(count), fc, removed)

The full script is here and relies on list all feature classes in GDB, including within feature datasets. It was written for removing empty feature classes in a geodatabase but it should work for shapefiles in a directory too. I don't use it inside a model, but run it after the model has completed to clean up afterwards.

share|improve this answer
    
thank you for your response, but i want a model to solve it. –  hvaezi Sep 28 '11 at 12:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.