def ExportGISProdLyrs(owner_workspace, admin_workspace): #similar to CANP, only for layers in another geodatabase, like GISPROD. owner = "GIS_CANSYS.SHARED." outpre = owner_workspace + "/" + owner print "exporting initialized at " + str(datetime.datetime.now()) destConnection = owner_workspace #once again, this could be change to the admin workspace for lyr in mapping.ListLayers(mxd): if lyr.name in gisprodlist: try: #manipulate the layer name a little bit differently lyrname = lyr.name[7:] print lyrname + " exporting..." outlyrname = lyrname outlyrobj = outpre + outlyrname Unlock(admin_workspace) FeatureClassToFeatureClass_conversion(lyr, destConnection, outlyrname, "#", "#", "#") ChangePrivileges_management(outlyrobj, "readonly", "GRANT", "AS_IS") print lyrname + " exported to " + outlyrname + " " + str( datetime.datetime.now()) except ExecuteError: msgs = GetMessages(2) AddError(msgs) print msgs endingTime = datetime.datetime.now() ScriptStatusLogging('CANP_LRS_EXPORT.py', 'ExportGISProdLyrs Function', scriptFailure, startingTime, endingTime, GetMessages(2)) pass except (RuntimeError, TypeError, NameError): print "TypeError on item" + lyr.name endingTime = datetime.datetime.now() ScriptStatusLogging('CANP_LRS_EXPORT.py', 'ExportGISProdLyrs Function', scriptFailure, startingTime, endingTime, GetMessages(2)) pass except: tb = sys.exc_info()[2] tbinfo = traceback.format_tb(tb)[0] pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str( sys.exc_info()[1]) msgs = "ArcPy ERRORS:\n" + GetMessages(2) + "\n" print pymsg + "\n" print msgs endingTime = datetime.datetime.now() ScriptStatusLogging('CANP_LRS_EXPORT.py', 'ExportGISProdLyrs Function', scriptFailure, startingTime, endingTime, GetMessages(2)) else: #print lyr.name +" was not in the export list and will be skipped" return
def AttribFields(fc, tbl, layer_name, table_name, workspace): #Updates the crossing type attribute values in the GIS database from the CANSYS table. I believe this should work but needs to be tested more. try: MakeFeatureLayer_management(fc, layer_name) MakeQueryTable_management(tbl, table_name, "USE_KEY_FIELDS", "CIIMS.CIIMS_VWCROSSINGGIS3.CROSSINGID", "#", "#") AddJoin_management(layer_name, "CROSSINGID", table_name, "CROSSINGID", "KEEP_ALL") SelectLayerByAttribute_management( layer_name, "NEW_SELECTION", "CIIMS.Static_Crossings.CROSSINGTYPE <> vwcrossings3.CROSSINGTYPE") with da.Editor( workspace) as edit: # @UnusedVariable @UndefinedVariable CalculateField_management(layer_name, 'CIIMS.Static_Crossings.CROSSINGTYPE', '!vwcrossings3.CROSSINGTYPE!', 'PYTHON_9.3') CalculateField_management(layer_name, "CIIMS.Static_Crossings.LOADDATE", "datetime.datetime.now( )", "PYTHON_9.3", "#") del layer_name, fc, table_name, tbl print "attrib fields updated for crossing type" except ExecuteError: print(GetMessages(2)) endingTime = datetime.datetime.now() ScriptStatusLogging('POINT_UPDATE_PROD.py', 'CIIMS.Static_Crossings', scriptFailure, startingTime, endingTime, GetMessages(2))
def LatLongFields(fc, tbl, layer_name, table_name, workspace): #Updates the XY attributes values in the GIS database from the CANSYS table try: MakeFeatureLayer_management(fc, layer_name) MakeQueryTable_management(tbl, table_name, "USE_KEY_FIELDS", "CIIMS.CIIMS_VWCROSSINGGIS3.CROSSINGID", "#", "#") AddJoin_management(layer_name, "CROSSINGID", table_name, "CROSSINGID", "KEEP_ALL") #select the rows where the CIIMS position has been changed SelectLayerByAttribute_management( layer_name, "NEW_SELECTION", "CIIMS.Static_Crossings.CROSSINGLATITUDE <> vwcrossings3.CROSSINGLATITUDE OR CIIMS.Static_Crossings.CROSSINGLONGITUDE <> vwcrossings3.CROSSINGLONGITUDE" ) with da.Editor( workspace) as edit: # @UnusedVariable @UndefinedVariable CalculateField_management( layer_name, 'CIIMS.Static_Crossings.CROSSINGLATITUDE', '!vwcrossings3.CROSSINGLATITUDE!', 'PYTHON_9.3') CalculateField_management( layer_name, 'CIIMS.Static_Crossings.CROSSINGLONGITUDE', '!vwcrossings3.CROSSINGLONGITUDE!', 'PYTHON_9.3') CalculateField_management(layer_name, "CIIMS.Static_Crossings.LOADDATE", "datetime.datetime.now( )", "PYTHON_9.3", "#") del layer_name, fc, table_name, tbl except ExecuteError: print(GetMessages(2)) endingTime = datetime.datetime.now() ScriptStatusLogging('POINT_UPDATE_PROD.py', 'CIIMS.Static_Crossings', scriptFailure, startingTime, endingTime, GetMessages(2))
def PostProcLRS(): #this will create the calibrated network LRMs and the calibration points which are useful for other referential methods MResolution = 0.0005 MTolerance = 0.001 env.MTolerance = MTolerance env.MResolution = MResolution try: #copying these layers, the routes measures are already calibrated, measures as they should be #the FC2Fc was changed in the document to show only the primary route, mitigating hte need for the V_LRSNETS view FeatureClassToFeatureClass_conversion( admin_workspace + "/GIS_CANSYS.DBO.V_LRSS_SDO_R", admin_workspace, "SMLRS", "DIRECTION in (1, 2)", "#", "#") ChangePrivileges_management(admin_workspace + "/GIS_CANSYS.DBO.SMLRS", "readonly", "GRANT", "AS_IS") FeatureClassToFeatureClass_conversion( admin_workspace + "/GIS_CANSYS.DBO.V_LRSC_SDO_R", admin_workspace, "CMLRS", "DIRECTION in (1, 2)", "#", "#") ChangePrivileges_management(admin_workspace + "/GIS_CANSYS.DBO.CMLRS", "readonly", "GRANT", "AS_IS") #Oracle EXOR require M values at ever vertex #over time EXOR measures have become a bit of a mess, because of non-functional route calibration tools prior to 2012-2013 #measures should be based on stationing and increase linearly along a project except at the location of an equation #assets are based on whatever section reference they are given, so if the section measures change, so does the asset location except: endingTime = datetime.datetime.now() ScriptStatusLogging('CANP_LRS_EXPORT.py', 'PostProcLRS Function', scriptFailure, startingTime, endingTime, GetMessages(2)) pass
def ListAllLyrs(): #function to list all the layers in the MXD/data frame, can be used to compare to printed CANPlist print "layer list initialized at " + str(datetime.datetime.now()) for lyr in mapping.ListLayers(mxd): try: lyrname = lyr.name print lyrname except: print "There was a problem with this layer: " + str(lyr.name) endingTime = datetime.datetime.now() ScriptStatusLogging( 'CANP_LRS_EXPORT.py', 'ListAllLyrs Function', scriptFailure, startingTime, endingTime, 'There was a problem with this layer: ' + str(lyr.name))
def PointGEOM(fc, tbl, workspace, layer_name, fields): #Updates the Geometry point location based on the XY attributes in the GIS table, run this after the XY attributes have been updated try: MakeFeatureLayer_management(fc, layer_name) #the tolerance is how close a lat/long field value must match the coordinate position Tolerance = 0.000001 #start the edit operation using the DA cursor edit = da.Editor(workspace) # @UndefinedVariable edit.startEditing() edit.startOperation() with da.UpdateCursor(fc, fields) as ucursor: # @UndefinedVariable for row in ucursor: #rows 0 and 1 are the lat long fields in the table point = Point(row[0], row[1]) #row 2 is the geometry lat long tuple, and needs to be split in to lat/long parts rowx, rowy = (row[2]) rowvalues = (row[0], row[1], point, datetime.datetime.now()) #compare the lat long table values to the point location if (type(rowx) == float): intolX = abs(row[0] - rowx) intolY = abs(row[1] - rowy) if intolX < Tolerance and intolY < Tolerance: pass else: #if the shape needs to be adjusted, this will update the coordinate position from the feild info point = Point(row[0], row[1]) rowvalues = (row[0], row[1], point, datetime.datetime.now()) print "these rows are outside the position tolerance:" print(rowvalues) ucursor.updateRow(rowvalues) #print (rowvalues) else: point = Point(row[0], row[1]) rowvalues = (row[0], row[1], point, datetime.datetime.now()) print "these rows need to be calculated:" print(rowvalues) ucursor.updateRow(rowvalues) edit.stopOperation() edit.stopEditing(True) del layer_name, fc, fields, workspace print "point geometry updated" except ExecuteError: print(GetMessages(2)) endingTime = datetime.datetime.now() ScriptStatusLogging('POINT_UPDATE_PROD.py', 'CIIMS.Static_Crossings', scriptFailure, startingTime, endingTime, GetMessages(2))
def PostProcCalibPts(): #this will create the calibrated network LRMs and the calibration points which are useful for other referential methods MResolution = 0.0005 MTolerance = 0.001 env.MTolerance = MTolerance env.MResolution = MResolution LRM_NAMES = ["SMLRS", "CMLRS"] try: for LRM in LRM_NAMES: print "converting " + LRM + " to point features " + str( datetime.datetime.now()) #this is rather expensive FeatureVerticesToPoints_management( admin_workspace + "/GIS_CANSYS.DBO." + LRM, admin_workspace + "/GIS_CANSYS.DBO." + LRM + "_Point", "ALL") print "adding calibration values to " + LRM + " point features " + str( datetime.datetime.now()) #this is VERY expensive and should be replaced by a da cursor that calculates SHAPE@M #for now this is easy and convenient to attribute the M value at every point AddXY_management(admin_workspace + "/GIS_CANSYS.DBO." + LRM + "_Point") #AddXY might take an hour total for both LRMS print "finished " + LRM + " LRM processing " + str( datetime.datetime.now()) ChangePrivileges_management( admin_workspace + "/GIS_CANSYS.DBO." + LRM + "_Point", "readonly", "GRANT", "AS_IS") except: endingTime = datetime.datetime.now() ScriptStatusLogging( 'CANP_LRS_EXPORT.py', 'PostProcCalibPts Function failed while attempting to calibrate ' + str(LRM), scriptFailure, startingTime, endingTime, GetMessages(2)) pass
def ExportNUSYS(admin_workspace): print "exporting initialized at " + str(datetime.datetime.now()) #set the output database, this could be changed to admin workspace destConnection = admin_workspace #copy the map extract table to the destination commented 5/8/2014 #TableToTable_conversion("MAP_EXTRACT",destConnection,"Map_Extract","#","#","#") #start the loop for layers in the mxd for lyr in mapping.ListLayers(nusys_mxd): #continue the loop operations for layers in the NUSYS MXD (unlisted) try: #manipulate the layer name a little bit lyrname = lyr.name print lyrname + " exporting..." outlyrname = lyrname outlyrobj = destConnection + "\\GIS_CANSYS.SHARED." + outlyrname #this should prevent ERROR 000258: Layer already exists, even though OverwriteOutput is true if Exists(outlyrobj): Delete_management(outlyrobj) #export the layer to SQL server FeatureClassToFeatureClass_conversion(lyr, destConnection, outlyrname, "#", "#", "#") #this is a total replacement, so grant the necessary administrative privileges ChangePrivileges_management(outlyrobj, "readonly", "GRANT", "AS_IS") #tell me what happened print lyrname + " exported to " + outlyrname + " " + str( datetime.datetime.now()) except ExecuteError: msgs = GetMessages(2) AddError(msgs) #tell me what went wrong if there was an execute error print msgs AcceptConnections(admin_workspace, True) endingTime = datetime.datetime.now() ScriptStatusLogging('CANP_LRS_EXPORT.py', 'ExportNUSYS Function', scriptFailure, startingTime, endingTime, GetMessages(2)) pass except (RuntimeError, TypeError, NameError): #tell me if there is a problem with one of the layers print "TypeError on item" + lyr.name AcceptConnections(admin_workspace, True) endingTime = datetime.datetime.now() ScriptStatusLogging('CANP_LRS_EXPORT.py', 'ExportNUSYS Function', scriptFailure, startingTime, endingTime, GetMessages(2)) pass except: tb = sys.exc_info()[2] tbinfo = traceback.format_tb(tb)[0] # Concatenate information together concerning the error into a message string pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str( sys.exc_info()[1]) msgs = "ArcPy ERRORS:\n" + GetMessages(2) + "\n" print pymsg + "\n" print msgs AcceptConnections(admin_workspace, True) endingTime = datetime.datetime.now() ScriptStatusLogging('CANP_LRS_EXPORT.py', 'ExportNUSYS Function', scriptFailure, startingTime, endingTime, GetMessages(2))
ExportCANPLyrs(owner_workspace, admin_workspace, CANPlist) #Export the NUSYS Rootes and layers #ExportNUSYS(admin_workspace) #update and process data that changes annually or less, or is time consuming to run #ExportCANPLyrs(owner_workspace, admin_workspace, CANPlistAADT) #PostProcAnnum(owner_workspace, admin_workspace) #Export the listed GISPROD layers ExportGISProdLyrs(owner_workspace, admin_workspace) #Update the Routes PostProcLRS() #Post process and dissolve the CANP layers for basic, efficient GIS use PostProcDissolve() #Don't run PostProcCalibPts every day, as needed #PostProcCalibPts() AcceptConnections(admin_workspace, True) print "done" endingTime = datetime.datetime.now() try: ScriptStatusLogging('CANP_LRS_EXPORT.py', 'CANSYS.SHARED.V_*', scriptSuccess, startingTime, endingTime, 'Completed Successfully') except: print "script completed, but no logging was written"
if __name__ == '__main__': MakeTableView_management(deltbl, "delcheck") delcount = int(GetCount_management("delcheck").getOutput(0)) if delcount > 0: print str(delcount) + " rows to delete" PointDelete(fc, layer_name, deltbl, table_name) else: print "no rows deleted" MakeTableView_management(newtbl, "NEWROWS_View", "#", "#", "#") addcount = int(GetCount_management("NEWROWS_View").getOutput(0)) if addcount > 0: print str(addcount) + " rows to add" AddInsert(fc, layer_name, newtbl, workspace) else: print "no new records" LatLongFields(fc, tbl, layer_name, table_name, workspace) AttribFields(fc, tbl, layer_name, table_name, workspace) PointGEOM(fc, tbl, workspace, layer_name, fields) AttribFields(fc, tbl, layer_name, table_name, workspace) #PointCheck(fc, fields, layer_name) endingTime = datetime.datetime.now() try: ScriptStatusLogging('POINT_UPDATE_PROD.py', 'CIIMS.Static_Crossings', scriptSuccess, startingTime, endingTime, 'Completed Successfully') except: print "script logging problem"
def PostProcDissolve(): owner = "GIS_CANSYS.DBO." outpre = admin_workspace + "/" + owner PostProcDissolveLocation = "" #each layer for GIS should be dissolved as multi-part lines so they can more efficiently be mapped online #each layer has different fields so each of these dissolves can be tested in ArcMap and copied to this script as needed try: PostProcDissolveLocation = "ACCS" ACCS = outpre + "ACCS" Unlock(admin_workspace) Dissolve_management( owner + "V_ACCS_SDO_V", ACCS, "CRND_RTE;LRS_KEY;STATE_LRS;ROUTE_NO;COUNTY_CD;COUNTY_NAME;LANE_DIRECTION;DISTRICT;DIV_UNDIV;ACS_CTRL_ID;ACS_CTRL_ID_DESC", "BCMP MIN;ECMP MAX;BSMP MIN;ESMP MAX", "MULTI_PART", "DISSOLVE_LINES") ChangePrivileges_management(ACCS, "readonly", "GRANT", "AS_IS") PostProcDissolveLocation = "SMAP" SMAP = outpre + "SMAP" Unlock(admin_workspace) Dissolve_management( owner + "V_SMAP_SDO_V", SMAP, "CRND_RTE;LRS_KEY;COUNTY_CD;COUNTY_NAME;LANE_DIRECTION;DISTRICT;DIV_UNDIV;STATIONING_TYPE;STATIONING_TYPE_DESC;BEGIN_STATIONING;BEGIN_STATIONING_DECIMAL;END_STATIONING;END_STATIONING_DECIMAL;PROJECT_YEAR;PROJECT_NUMBER;PROJECT_TYPE;PROJECT_TYPE_DESC;HOST_PROJECT_NUMBER;PW_URL", "BCMP MIN;ECMP MAX;BSMP MIN;ESMP MAX", "MULTI_PART", "DISSOLVE_LINES") ChangePrivileges_management(SMAP, "readonly", "GRANT", "AS_IS") print "SMAP dissolved for viewing" PostProcDissolveLocation = "LYRS" LYRS = outpre + "LYRS" Dissolve_management( owner + "V_LYRS_SDO_V", LYRS, "CRND_RTE;LRS_KEY;COUNTY_CD;COUNTY_NAME;LANE_DIRECTION;DISTRICT;DIV_UNDIV;LAYER_TYPE;LAYER_TYPE_DESC;MATERIAL_TYPE;MATERIAL_TYPE_DESC;DEPTHS_MILLIMETERS;LAYER_DATE;MATERIAL_WIDTH_METERS;MATERIAL_WIDTH_FEET;SOURCE_TYPE;SOURCE_TYPE_DESC;PROJECT_ID;PW_URL", "BCMP MIN;ECMP MAX;BSMP MIN;ESMP MAX", "MULTI_PART", "DISSOLVE_LINES") ChangePrivileges_management(LYRS, "readonly", "GRANT", "AS_IS") print "LYRS dissolved for viewing" PostProcDissolveLocation = "LNCL" LNCL = outpre + "LNCL" MakeFeatureLayer_management( outpre + "V_LNCL_SDO_V", "LNCL_PRIMARY", "CRND_RTE LIKE '%EB' OR CRND_RTE LIKE '%NB'", "#", "OBJECTID OBJECTID VISIBLE NONE;CRND_RTE CRND_RTE VISIBLE NONE;LRS_KEY LRS_KEY VISIBLE NONE;BCMP BCMP VISIBLE NONE;ECMP ECMP VISIBLE NONE;BSMP BSMP VISIBLE NONE;ESMP ESMP VISIBLE NONE;COUNTY_CD COUNTY_CD VISIBLE NONE;COUNTY_NAME COUNTY_NAME VISIBLE NONE;LANE_DIRECTION LANE_DIRECTION VISIBLE NONE;DISTRICT DISTRICT VISIBLE NONE;DIV_UNDIV DIV_UNDIV VISIBLE NONE;LNCL_CLS_ID LNCL_CLS_ID VISIBLE NONE;LNCL_CLS_ID_DESC LNCL_CLS_ID_DESC VISIBLE NONE;LNCL_DT LNCL_DT VISIBLE NONE;Shape Shape VISIBLE NONE;Shape.STLength() Shape.STLength() VISIBLE NONE" ) Dissolve_management( "LNCL_PRIMARY", LNCL, "CRND_RTE;LRS_KEY;COUNTY_CD;COUNTY_NAME;LANE_DIRECTION;DISTRICT;DIV_UNDIV;LNCL_CLS_ID;LNCL_CLS_ID_DESC", "BCMP MIN;ECMP MAX;BSMP MIN;ESMP MAX", "MULTI_PART", "DISSOLVE_LINES") ChangePrivileges_management(LNCL, "readonly", "GRANT", "AS_IS") print "LNCL dissolved for viewing" PostProcDissolveLocation = "CPMS" CPMS = outpre + "CPMS" Dissolve_management( owner + "V_CPMS_SDO_V", CPMS, "CRND_RTE;LRS_KEY;COUNTY_CD;COUNTY_NAME;LANE_DIRECTION;DISTRICT;DIV_UNDIV;SCHEME_ID;PROJECT_ID;TECH_NAME;WORK_TYPE_DESC;DESIGN_CRITERIA;LEG_MAP_ID;CATEGORY_CODE;SUBCAT_CODE;PROJECT_DESC_FRND;PROJ_DISTRICT;PROJ_AREA;PROJ_SUB_AREA;PROJ_LENGTH;HOST_PROJ_NUM;FISCAL_YEAR_PRGM;LETTING_DATE;PW_URL", "BCMP MIN;BSMP MIN;ECMP MAX;ESMP MAX", "MULTI_PART", "DISSOLVE_LINES") ChangePrivileges_management(CPMS, "readonly", "GRANT", "AS_IS") print "CPMS dissolved for viewing" PostProcDissolveLocation = "POEQ" POEQ = outpre + "POEQ" Dissolve_management( owner + "V_POEQ_SDO_V", POEQ, "CRND_RTE;LRS_KEY;COUNTY_CD;COUNTY_NAME;LANE_DIRECTION;DISTRICT;DIV_UNDIV;IRIR;RLIFE;RLIFE_DEFAULT;RLIFE_DEFAULT_DESC;EQFAULT;EQJD;EQTCR;RUTVAL;PVMTGRP;PVMTGRP_DESC;DEF_FLAG;DEF_FLAG_DESC;POEQ_DT;MEAN_IRIR;YEAR_LAST_IMP;YEAR_LAST_CONST;LAST_OVERLAY_THIC;IRIR_DATE;IRIR_DATE_DEFAULT;IRIR_DATE_DEFAULT_DESC", "BCMP MIN;ECMP MAX;BSMP MIN;ESMP MAX", "MULTI_PART", "DISSOLVE_LINES") ChangePrivileges_management(POEQ, "readonly", "GRANT", "AS_IS") print "POEQ dissolved for viewing" PostProcDissolveLocation = "HPPA" HPPA = outpre + "HPPA" Dissolve_management( owner + "V_HPPA_SDO_V", HPPA, "CRND_RTE;LRS_KEY;COUNTY_CD;COUNTY_NAME;LANE_DIRECTION;DISTRICT;DIV_UNDIV;HPMS_SURFACE_TYPE;HPMS_SURFACE_TYPE_DESC;HPMS_YEAR_LAST_IMPROV;HPMS_YEAR_LAST_CONST;HPMS_LAST_OVERLAY_THICK;HPMS_THICKNESS_RIGID;HPMS_THICKNESS_FLEXIBLE;HPMS_BASE_TYPE;HPMS_BASE_TYPE_DESC;HPMS_BASE_THICKNESS", "BCMP MIN;ECMP MAX;BSMP MIN;ESMP MAX", "MULTI_PART", "DISSOLVE_LINES") ChangePrivileges_management(HPPA, "readonly", "GRANT", "AS_IS") #print "HPPA dissolved for viewing" PostProcDissolveLocation = "SPED" SPED = outpre + "SPED" Dissolve_management( owner + "V_SPED_SDO_V", SPED, "CRND_RTE;LRS_KEY;COUNTY_CD;COUNTY_NAME;LANE_DIRECTION;DISTRICT;DIV_UNDIV;SPD_LMT;SPD_LMT_DESC;SPED_RESOL", "#", "MULTI_PART", "DISSOLVE_LINES") ChangePrivileges_management(SPED, "readonly", "GRANT", "AS_IS") #print "SPED dissolved for viewing" PostProcDissolveLocation = "FUN" FUN = outpre + "FUN" Dissolve_management( owner + "V_FUN_SDO_V", FUN, "CRND_RTE;LRS_KEY;COUNTY_CD;COUNTY_NAME;LANE_DIRECTION;DISTRICT;DIV_UNDIV;FUN_CLASS;FUN_CLASS_DESC;OLD_FUN_CLASS", "BCMP MIN;ECMP MAX;BSMP MIN;ESMP MAX", "MULTI_PART", "DISSOLVE_LINES") ChangePrivileges_management(FUN, "readonly", "GRANT", "AS_IS") #print "FUN dissolved for viewing" PostProcDissolveLocation = "LANE" LANE = outpre + "LANE" Dissolve_management( owner + "V_LANE_SDO_V", LANE, "CRND_RTE;LRS_KEY;COUNTY_CD;COUNTY_NAME;LANE_DIRECTION;DISTRICT;DIV_UNDIV;LN_ID;LN_ID_DESC;LN_WDTH;LN_WDTH_FT;XSP;XSP_DESCR;HOV;HOV_DESC", "BCMP MIN;ECMP MAX;BSMP MIN;ESMP MAX", "MULTI_PART", "DISSOLVE_LINES") ChangePrivileges_management(LANE, "readonly", "GRANT", "AS_IS") #print "LANE dissolved for viewing" PostProcDissolveLocation = "NHS" NHS = outpre + "NHS" Dissolve_management( owner + "V_NHS_SDO_V", NHS, "LRS_KEY;COUNTY_CD;COUNTY_NAME;DISTRICT;NHS_ID;NHS_ID_DESC", "BCMP MIN;ECMP MAX;BSMP MIN;ESMP MAX", "MULTI_PART", "DISSOLVE_LINES") ChangePrivileges_management(NHS, "readonly", "GRANT", "AS_IS") #print "NHS dissolved for viewing" PostProcDissolveLocation = "SHLD" SHLD = outpre + "SHLD" Dissolve_management( owner + "V_SHLD_SDO_V", SHLD, "CRND_RTE;LRS_KEY;COUNTY_CD;COUNTY_NAME;LANE_DIRECTION;DISTRICT;DIV_UNDIV;SHLDR_ID;SHLDR_ID_DESC;FORESLOPE;SHLDR_WDTH;SHLDR_WDTH_FT;XSP;XSP_DESCR", "BCMP MIN;ECMP MAX;BSMP MIN;ESMP MAX", "MULTI_PART", "DISSOLVE_LINES") ChangePrivileges_management(SHLD, "readonly", "GRANT", "AS_IS") #print "SHLD dissolved for viewing" PostProcDissolveLocation = "MED" MED = outpre + "MED" MakeFeatureLayer_management( owner + "V_MED_SDO_V", "MED_PRIMARY", "CRND_RTE LIKE '%EB' OR CRND_RTE LIKE '%NB'", "#", "#") Dissolve_management( "MED_PRIMARY", MED, "CRND_RTE;LRS_KEY;COUNTY_CD;COUNTY_NAME;LANE_DIRECTION;DISTRICT;DIV_UNDIV;MED_ID;MED_ID_DESC;MED_WDTH; MED_WDTH_FT", "BCMP MIN;ECMP MAX;BSMP MIN;ESMP MAX", "MULTI_PART", "DISSOLVE_LINES") ChangePrivileges_management(MED, "readonly", "GRANT", "AS_IS") #print "MED dissolved for viewing" PostProcDissolveLocation = "RMBL" RMBL = outpre + "RMBL" Dissolve_management( owner + "V_RMBL_SDO_V", RMBL, "CRND_RTE;LRS_KEY;COUNTY_CD;COUNTY_NAME;LANE_DIRECTION;DISTRICT;DIV_UNDIV;RMBL_SHAPE;RMBL_SHAPE_DESC;HOST_PRJCT_ID;PRJCT_ID;RMBL_SOURCE;RMBL_SOURCE_DESC;XSP;XSP_DESCR", "BCMP MIN;ECMP MAX;BSMP MIN;ESMP MAX", "MULTI_PART", "DISSOLVE_LINES") ChangePrivileges_management(RMBL, "readonly", "GRANT", "AS_IS") #print "RMBL dissolved for viewing" PostProcDissolveLocation = "SWID" SWID = outpre + "SWID" Dissolve_management( owner + "V_SWID_SDO_V", SWID, "CRND_RTE;LRS_KEY;COUNTY_CD;COUNTY_NAME;LANE_DIRECTION;DISTRICT;DIV_UNDIV;SRFC_WDTH; SRFC_WDTH_FT", "BCMP MIN;ECMP MAX;BSMP MIN;ESMP MAX", "MULTI_PART", "DISSOLVE_LINES") ChangePrivileges_management(SWID, "readonly", "GRANT", "AS_IS") PostProcDissolveLocation = "" except: endingTime = datetime.datetime.now() if PostProcDissolveLocation != "": ScriptStatusLogging( 'CANP_LRS_EXPORT.py', 'PostProcDissolve failed while attempting to dissolve ' + str(PostProcDissolveLocation), scriptFailure, startingTime, endingTime, GetMessages(2)) #elif: #ERROR 000732: path not valid else: ScriptStatusLogging('CANP_LRS_EXPORT.py', 'PostProcDissolve Function', scriptFailure, startingTime, endingTime, GetMessages(2)) pass