# Usage: LineToProjectTransaction <Distance> <Feature_Set> <xxbuf_shp> # Description:# Add Agency Projects to the master GIS Project database that are best mapped as linear features such as road or utility corridors. # User enters the project transaction year, project number, and their initials, then digitizes a line on the map. A 100 foot wide buffer polygon is calculated from the digitized line.# The buffer polygon is appended with attributes to Transaction_poly layer in GIS_MAD sde db.# ---------------------------------------------------------------------------# Import arcpy moduleimport arcpy# Script argumentsProject_Year = arcpy.GetParameterAsText(0)if Project_Year == '#' or not Project_Year: Project_Year = "2013" # provide a default value if unspecifiedProject_Number_eg_0025 = arcpy.GetParameterAsText(1)Your_initials = arcpy.GetParameterAsText(2)Distance = arcpy.GetParameterAsText(3)if Distance == '#' or not Distance: Distance = "50 Feet" # provide a default value if unspecifiedInput_Line = arcpy.GetParameterAsText(4)if Input_Line == '#' or not Input_Line: Input_Line = "M:\\ApaGis\\Scratch\\scratch.gdb\\xxline2" # provide a default value if unspecifiedTransactionPoly2 = arcpy.GetParameterAsText(5)if TransactionPoly2 == '#' or not TransactionPoly2: TransactionPoly2 = "Database Connections\\GIS_MAD.sde\\GIS_MAD.DBO.Transaction_Poly" # provide a default value if unspecified# Local variables:xxbuffer = "M:\\ApaGis\\Scratch\\scratch.gdb\\xxbuf"GIS_MAD_DBO_Transaction_Poly = "Database Connections\\GIS_MAD.sde\\GIS_MAD.DBO.Transaction_Poly"APANUMBER = "'"+'P'+Project_Year+"-"+Project_Number_eg_0025.upper()+"'"# Check for the existance of in_memory\\BufferedLine output data before running Buffer.if arcpy.Exists("M:\\ApaGis\\Scratch\\scratch.gdb\\xxbuf"): arcpy.Delete_management("M:\\ApaGis\\Scratch\\scratch.gdb\\xxbuf")# Process: Bufferarcpy.Buffer_analysis(Input_Line, xxbuffer, Distance, "FULL", "FLAT", "NONE", "")# Process: Calculate Transaction Typearcpy.CalculateField_management(xxbuffer, "TRANSACTIONTYPE", "'P'", "PYTHON", "")# Process: Calculate APA Numberarcpy.CalculateField_management(xxbuffer, "APANUMBER", APANUMBER, "PYTHON", "")# Process: Calculate Data Entry Datearcpy.CalculateField_management(xxbuffer, "FEATUREDATE", "datetime.datetime.now( )", "PYTHON", "")# Process: Calculate Feature Sourcearcpy.CalculateField_management(xxbuffer, "FEATURESOURCE", "'20'", "PYTHON", "")# Process: Calculate Staffarcpy.CalculateField_management(xxbuffer, "STAFF", '"'+Your_initials.upper()+'"', "PYTHON", "")# Process: Appendarcpy.Append_management(xxbuffer, GIS_MAD_DBO_Transaction_Poly, "No_TEST", "", "")# Process: Deletearcpy.Delete_management(Input_Line)# Process: Deletearcpy.Delete_management(xxbuffer)arcpy.RefreshActiveView()
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.