def analyze(workspace,datasets,tNames,tFullNames): retVal = True for dataset in datasets: name = dataset.getAttributeNode("name").nodeValue targetTable = gzSupport.getFullName(name,tNames,tFullNames) arcpy.SetProgressorLabel("Analyzing " + name) try: arcpy.Analyze_management(targetTable,"BUSINESS") arcpy.Analyze_management(targetTable,"ADDS") arcpy.Analyze_management(targetTable,"DELETES") arcpy.Analyze_management(targetTable,"FEATURE") except: retVal = False return retVal
def analyze(self, components=['BUSINESS', 'ADDS', 'DELETES']): return self.interpret( arcpy.Analyze_management(self.featureclass, components))
print 'WARNING \n fileLog path may not exist.' #------------------------------------------------------------------------------- try: print 'Changing workspace to: ' + pudConnectionFile logging.info('Changing workspace to: ' + pudConnectionFile) arcpy.env.workspace = pudConnectionFile allDatasets = arcpy.ListDatasets() for data_set in allDatasets: if data_set in PUD_Datasets: print 'Analyzing: ' + data_set + ' data set' logging.info('Analyzing: ' + data_set + ' data set') # Process: arcpy.Analyze_management(data_set, 'BUSINESS;FEATURE') except Exception as e: print '\nERROR!!!' logging.info('ERROR!!!') print str(e) logging.info(str(e)) success = False #------------------------------------------------------------------------------- # Print final message based on if successful or not if success == True: print '\nSUCCESS \n Done running Analyze_AllPUDDatasets.py' logging.info('SUCCESS \n Done running Analyze_AllPUDDatasets.py')
output = open(LogFile, "w") output.write("GISAnalyze\n") output.write(strmsg1) for fileLine in workspacelist: ENV.workspace = fileLine.replace("\n", "") strmsg1 = "Process Workspace: " + fileLine + "\n" print strmsg1 output.write(strmsg1) try: FCList = arcpy.ListFeatureClasses("*", "Point;Arc;Region;Annotation") for FC in FCList: strmsg1 = "Process FeatureClass: " + FC.encode("gb2312") + "\n" print strmsg1 output.write(strmsg1) arcpy.Analyze_management(FC, "BUSINESS") print arcpy.GetMessages().encode("gb2312") + "\n" output.write(arcpy.GetMessages().encode("gb2312") + "\n") #arcpy.Analyze_management(FC, "FEATURE") #print arcpy.GetMessages().encode("gb2312") + "\n" #output.write(arcpy.GetMessages().encode("gb2312")+ "\n") arcpy.Analyze_management(FC, "ADDS") print arcpy.GetMessages().encode("gb2312") + "\n" output.write(arcpy.GetMessages().encode("gb2312") + "\n") arcpy.Analyze_management(FC, "DELETES") print arcpy.GetMessages().encode("gb2312") + "\n" output.write(arcpy.GetMessages().encode("gb2312") + "\n") DSList = arcpy.ListDatasets("*", "all") for DS in DSList: strmsg1 = "Process Dataset: " + DS.encode("gb2312") + "\n" print strmsg1