Guest User

Untitled

a guest
May 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. import arcpy
  2. import os
  3. GDB_input=arcpy.GetParameterAsText(0)
  4. ClipFeature = arcpy.GetParameterAsText(1)
  5. a=GDB_input+"\"
  6.  
  7. arcpy.env.workspace=GDB_input
  8. fclist=arcpy.ListFeatureClasses()
  9. for fc in fclist:
  10. arcpy.Clip_analysis(a+fc, ClipFeature,a+fc+'a')
  11. for fc in fclist:
  12. result = arcpy.GetCount_management(fc)
  13. countvalue = int(result.getOutput(0))
  14. if int(countvalue) == 0:
  15. arcpy.Delete_management(fc)
  16. fclist=arcpy.ListFeatureClasses()
  17. datasets = arcpy.ListDatasets("*")
  18. datasets.append('')
  19. for dataset in datasets:
  20. fc_names = arcpy.ListFeatureClasses("*", "", dataset)
  21. for fc_name in fc_names:
  22. out_name = fc_name.replace(fc_name, fc_name[:-1])
  23. fc_in = os.path.join(GDB_input, dataset, fc_name)
  24. fc_out = os.path.join(GDB_input, dataset, out_name)
  25. arcpy.Rename_management(fc_in, fc_out)
Add Comment
Please, Sign In to add comment