def mainWithPrefixSets(): # For now, use globals. # Make into prettier/prefixSetFirst Python later, that uses # dictionary values for everything, including default dictionary values # for when the usePrefixSetTestingAndReporting value is false. # Start a loop for prefixKeyItem in prefixSetErrorReportingDict.keys(): # Then, set the necessary variables from the dict # for the current prefix set in the list. prefixKeyItemDict = outerTestDict[prefixKeyItem] dataReviewExportDict = prefixKeyItemDict["dataReviewExportDict"] global errorReportCSV errorReportCSV = dataReviewExportDict["errorReportCSV"] global errorFeaturesQCGDBName errorFeaturesQCGDBName = dataReviewExportDict["errorFeaturesQCGDBName"] global errorFeaturesQCGDB errorFeaturesQCGDB = dataReviewExportDict["errorFeaturesQCGDB"] global multipart_point_errors multipart_point_errors = dataReviewExportDict["multipart_point_errors"] global multipart_line_errors multipart_line_errors = dataReviewExportDict["multipart_line_errors"] global single_part_point_errors single_part_point_errors = dataReviewExportDict[ "single_part_point_errors"] global single_part_line_errors single_part_line_errors = dataReviewExportDict[ "single_part_line_errors"] # Then, try running the setupQCGDB and export functions setupQCGDB() pointErrorsExportToQCGDB() lineErrorsExportToQCGDB()
def mainWithPrefixSets(): # For now, use globals. # Make into prettier/prefixSetFirst Python later, that uses # dictionary values for everything, including default dictionary values # for when the usePrefixSetTestingAndReporting value is false. # Start a loop for prefixKeyItem in prefixSetErrorReportingDict.keys(): # Then, set the necessary variables from the dict # for the current prefix set in the list. prefixKeyItemDict = outerTestDict[prefixKeyItem] dataReviewExportDict = prefixKeyItemDict["dataReviewExportDict"] global errorFeaturesQCGDB errorFeaturesQCGDB = dataReviewExportDict["errorFeaturesQCGDB"] global single_part_point_errors single_part_point_errors = dataReviewExportDict["single_part_point_errors"] global single_part_line_errors single_part_line_errors = dataReviewExportDict["single_part_line_errors"] rAndHCheckdict = prefixKeyItemDict["rAndHCheckdict"] global nonMonotonicOutputGDB nonMonotonicOutputGDB = rAndHCheckdict["nonMonotonicOutputGDB"] global nonMonotonicOutputFC nonMonotonicOutputFC = rAndHCheckdict["nonMonotonicOutputFC"] csipDict = prefixKeyItemDict["csipDict"] csip_output_gdb1 = csipDict["csip_output_gdb1"] global csip_check_output csip_check_output = os.path.join(csip_output_gdb1, 'Routes_SelfIntClassification_' + prefixKeyItem) global prefixesToMoveErrorsFor prefixesToMoveErrorsFor = [single_part_point_errors, single_part_line_errors, nonMonotonicOutputFC, csip_check_output] # Use the prefix key item for the current prefix name. moveLocalErrorsToSQL(prefixKeyItem)
def mainWithPrefixSets(): # For now, use globals. # Make into prettier/prefixSetFirst Python later, that uses # dictionary values for everything, including default dictionary values # for when the usePrefixSetTestingAndReporting value is false. # Start a loop for prefixKeyItem in prefixSetErrorReportingDict.keys(): # Then, set the necessary variables from the dict # for the current prefix set in the list. prefixKeyItemDict = outerTestDict[prefixKeyItem] dataReviewerDict = prefixKeyItemDict["dataReviewerDict"] global workspaceToReview workspaceToReview = dataReviewerDict["workspaceToReview"] global reviewerSessionGDB reviewerSessionGDB = dataReviewerDict["reviewerSessionGDB"] global reviewerSession reviewerSession = dataReviewerDict["reviewerSession"] global sessionReviewerSession sessionReviewerSession = dataReviewerDict["sessionReviewerSession"] global reviewerBatchJob reviewerBatchJob = dataReviewerDict["reviewerBatchJob"] # Then, try running the reviewData function reviewData()
def mainWithPrefixSets(): # For now, use globals. # Make into prettier/prefixSetFirst Python later, that uses # dictionary values for everything, including default dictionary values # for when the usePrefixSetTestingAndReporting value is false. # Start a loop for prefixKeyItem in prefixSetErrorReportingDict.keys(): global prefixKeyString prefixKeyString = prefixKeyItem # Then, set the necessary variables from the dict # for the current prefix set in the list. prefixKeyItemDict = outerTestDict[prefixKeyItem] csipDict = prefixKeyItemDict["csipDict"] global fc1 csip_routes = csipDict["csip_routes"] fc1 = csip_routes print("fc1 = " + str(fc1) + ".") global route_id_fld1 csip_route_id_fld1 = csipDict["csip_route_id_fld1"] route_id_fld1 = csip_route_id_fld1 print("route_id_fld1 = " + str(route_id_fld1) + ".") global output_gdb1 csip_output_gdb1 = csipDict["csip_output_gdb1"] output_gdb1 = csip_output_gdb1 print("output_gdb1 = " + str(output_gdb1) + ".") # added variable for FileGDB creation output_gdb1_name = returnGDBOrSDEName(output_gdb1) # other prep statements arcpy.env.overwriteOutput = True # If the outputGDB already exists, delete it. if arcpy.Exists(output_gdb1): arcpy.Delete_management(output_gdb1) else: pass time.sleep(10) # Then, (re)create it. arcpy.CreateFileGDB_management(mainFolder, output_gdb1_name) AnalyzePolylines(fc1, route_id_fld1, output_gdb1)
def mainWithPrefixSets(): # For now, use globals. # Make into prettier/prefixSetFirst Python later, that uses # dictionary values for everything, including default dictionary values # for when the usePrefixSetTestingAndReporting value is false. # Start a loop for prefixKeyItem in prefixSetErrorReportingDict.keys(): global prefixKeyString prefixKeyString = prefixKeyItem # Then, set the necessary variables from the dict # for the current prefix set in the list. prefixKeyItemDict = outerTestDict[prefixKeyItem] csipDict = prefixKeyItemDict["csipDict"] global fc1 csip_routes = csipDict["csip_routes"] fc1 = csip_routes print("fc1 = " + str(fc1) + ".") global route_id_fld1 csip_route_id_fld1 = csipDict["csip_route_id_fld1"] route_id_fld1 = csip_route_id_fld1 print("route_id_fld1 = " + str(route_id_fld1) + ".") global output_gdb1 csip_output_gdb1 = csipDict["csip_output_gdb1"] output_gdb1 = csip_output_gdb1 print("output_gdb1 = " + str(output_gdb1) + ".") # added variable for FileGDB creation output_gdb1_name = returnGDBOrSDEName(output_gdb1) # other prep statements arcpy.env.overwriteOutput = True # If the outputGDB already exists, delete it. if arcpy.Exists(output_gdb1): arcpy.Delete_management(output_gdb1) else: pass time.sleep(10) # Then, (re)create it. arcpy.CreateFileGDB_management(mainFolder, output_gdb1_name) AnalyzePolylines(fc1, route_id_fld1, output_gdb1)
def mainWithPrefixSets(): # For now, use globals. # Make into prettier/prefixSetFirst Python later, that uses # dictionary values for everything, including default dictionary values # for when the usePrefixSetTestingAndReporting value is false. # Start a loop for prefixKeyItem in prefixSetErrorReportingDict.keys(): # Then, set the necessary variables from the dict # for the current prefix set in the list. prefixKeyItemDict = outerTestDict[prefixKeyItem] dataReviewExportDict = prefixKeyItemDict["dataReviewExportDict"] csipDict = prefixKeyItemDict["csipDict"] global errorReportCSVName errorReportCSVName = dataReviewExportDict["errorReportCSVName"] global errorReportCSV errorReportCSV = dataReviewExportDict["errorReportCSV"] #Non-global, passed directly into the function global revTable revTable = dataReviewExportDict["revTable"] global originTablesGDB originTablesGDB = dataReviewExportDict["originTablesGDB"] global errorFeaturesGDB errorFeaturesGDB = dataReviewExportDict["errorFeaturesGDB"] global nonMonotonicOutputFC nonMonotonicOutputFC = dataReviewExportDict["nonMonotonicOutputFC"] global single_part_point_errors single_part_point_errors = dataReviewExportDict[ "single_part_point_errors"] global single_part_line_errors single_part_line_errors = dataReviewExportDict[ "single_part_line_errors"] global csip_output_gdb1 csip_output_gdb1 = csipDict["csip_output_gdb1"] exportErrorsToFeatureClasses(revTable, originTablesGDB, errorFeaturesGDB, mainFolder) reportExtensionForRAndHCheck(nonMonotonicOutputFC) reportExtensionForQCGDB(single_part_point_errors, single_part_line_errors) reportExtensionForCSIP(csip_output_gdb1)
def mainWithPrefixSets(): for prefixKeyItem in prefixSetErrorReportingDict.keys(): # Then, set the necessary variables from the dict # for the current prefix set in the list. prefixKeyItemDict = outerTestDict[prefixKeyItem] rAndHCheckdict = prefixKeyItemDict["rAndHCheckdict"] global nonMonotonicOutputGDB nonMonotonicOutputGDB = rAndHCheckdict["nonMonotonicOutputGDB"] global nonMonotonicOutputFC nonMonotonicOutputFC = rAndHCheckdict["nonMonotonicOutputFC"] global networkToReview networkToReview = rAndHCheckdict["networkToReview"] print("nonMonotonicOutputGDB: " + str(nonMonotonicOutputGDB) + ".") print("nonMonotonicOutputFC: " + str(nonMonotonicOutputFC) + ".") print("networkToReview: " + str(networkToReview) + ".") # Then, try running the reviewData function roadsNonMonoCheck()
def mainWithPrefixSets(): # For now, use globals. # Make into prettier/prefixSetFirst Python later, that uses # dictionary values for everything, including default dictionary values # for when the usePrefixSetTestingAndReporting value is false. # Start a loop print("Route creation loop started for the Prefix Set GDBs.") for prefixKeyItem in prefixSetErrorReportingDict.keys(): # Then, set the necessary variables from the dict # for the current prefix set in the list. prefixKeyItemDict = outerTestDict[prefixKeyItem] routeCreationDict = prefixKeyItemDict["routeCreationDict"] global outputRoutes outputRoutes = routeCreationDict["outputRoutes"] global featureLayerCL_For_Start_CP featureLayerCL_For_Start_CP = routeCreationDict["featureLayerCL_For_Start_CP"] global featureLayerCL_For_End_CP featureLayerCL_For_End_CP = routeCreationDict["featureLayerCL_For_End_CP"] global routesSourceCenterlines routesSourceCenterlines = routeCreationDict["routesSourceCenterlines"] global startCalibrationPoints startCalibrationPoints = routeCreationDict["startCalibrationPoints"] global endCalibrationPoints endCalibrationPoints = routeCreationDict["endCalibrationPoints"] global mergedCalibrationPoints mergedCalibrationPoints = routeCreationDict["mergedCalibrationPoints"] global dissolvedCalibrationPoints dissolvedCalibrationPoints = routeCreationDict["dissolvedCalibrationPoints"] global lrsRoutesGDB lrsRoutesGDB = routeCreationDict["lrsRoutesGDB"] # Then, try running the routeCreation function # and see if you can get the routeCreation function # to work and apply it's calls correctly to the # variables that you've specified. print("\nRoute creation started for the prefixKeyItem of: " + str(prefixKeyItem) + ".") routeCreation() print("Route creation completed for the prefixKeyItem of: " + str(prefixKeyItem) + ".") print("Route creation loop completed for the Prefix Set GDBs.")
def main(): if usePrefixSetTestingAndReporting == True: for prefixKey in prefixSetErrorReportingDict.keys(): prefixAttributeQuery = prefixSetErrorReportingDict[prefixKey] prefixKeyItemDict = outerTestDict[prefixKey] prefixSetGdbBaseName = prefixKeyItemDict["prefixSetGdbBaseName"] prefixSetSourceGDBName = prefixSetGdbBaseName + '_Source.gdb' prefixSetSourceGDBLocation = os.path.join(mainFolder, prefixSetSourceGDBName) routesSourceOutputLocation = os.path.join( prefixSetSourceGDBLocation, 'RoutesSource') try: Delete_management( routesSourceFCAsALayer ) #pre-emptive layer delete prior to rebuilding it time.sleep(3) except: pass MakeFeatureLayer_management(routesSourceFC, routesSourceFCAsALayer) routesSourceSelectionClause = """ """ + str( prefixAttributeQuery) + """ """ SelectLayerByAttribute_management(routesSourceFCAsALayer, "NEW_SELECTION", routesSourceSelectionClause) if Exists(returnGDBOrSDEPath(routesSourceOutputLocation)): pass else: CreateFileGDB_management( mainFolder, returnGDBOrSDEName( returnGDBOrSDEPath(routesSourceOutputLocation))) # Checking to see if the output already exists. # If so, remove it. if Exists(routesSourceOutputLocation): print( "Deleting the previous routesSourceOutputLocation at: \n" + str(routesSourceOutputLocation) + ".") Delete_management(routesSourceOutputLocation) time.sleep(7) else: pass # Create a new file for the output. print( "Making a copy of the selection in the routesSourceFCAsALayer at: \n" + routesSourceOutputLocation + ".") CopyFeatures_management(routesSourceFCAsALayer, routesSourceOutputLocation) #Repeat for each of the other layers to be copied into the new *_Source.gdb. for itemToCopy in otherFCsToCopyList: itemToCopyInputLocation = os.path.join( returnGDBOrSDEPath(routesSourceFC), itemToCopy) itemToCopyOutputLocation = os.path.join( prefixSetSourceGDBLocation, itemToCopy) if Exists(itemToCopyOutputLocation): print( "Deleting the previous itemToCopyOutputLocation at: \n" + str(itemToCopyOutputLocation) + ".") Delete_management(itemToCopyOutputLocation) time.sleep(7) else: pass print("Making a copy of the itemToCopy at: \n" + str(itemToCopyOutputLocation) + ".") CopyFeatures_management(itemToCopyInputLocation, itemToCopyOutputLocation) else: print( "The usePrefixSetTestingAndReporting value is not True. Will not create separate prefix set gdbs." )