Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import arcpy
- #Set join parameter variables
- inFeatures = arcpy.GetParameterAsText(0) #This is a feature class of forest roads. It is a feature class data type in the script tool in ArcGIS
- inField = arcpy.GetParameterAsText(1) #This is the join field in the feature class. This is a field data type in the stript tool in ArcGIS
- joinTable = arcpy.GetParameterAsText(2) #This is a table of buffer widths by road class. This is a table data type in the script tool in ArcGIS
- joinField = arcpy.GetParameterAsText(3) #This is the join field in the buffer table. This is a field data type in the script tool in ArcGIS
- arcpy.MakeFeatureLayer_management(inFeatures,"inFeatures_lyr") #make feature layer from feature class
- #Join road feature class to buffer distance table
- arcpy.JoinField_management("inFeatures_lyr", inField, joinTable, joinField)
- #Select roads that intersect the stdsm feature class
- stdsM = arcpy.GetParameterAsText(4) #this is a polygon feature class. It is a feature class data type in ArcGIS
- arcpy.MakeFeatureLayer_management(stdsM,"stdsM_lyr") #make feature layer from feature class
- arcpy.SelectLayerByLocation_management("inFeatures_lyr", "INTERSECT", "stdsM_lyr")
- #create output parameter and buffer roads
- outFeatures = arcpy.GetParameterAsText(5) #This is the output feature class of road buffers. This is a feature class data type in the script tool in ArcGIS
- arcpy.Buffer_analysis("infeatures_lyr", outFeatures, "DISTANCE")
- #Remove join from Roads
- arcpy.RemoveJoin_management("inFeatures_lyr")
- #Add identifying field to buffer layer and calculate a value
- arcpy.MakeFeatureLayer_management(outFeatures, "outFeatures_lyr")
- arcpy.AddField_management("outFeatures_lyr", "BUFFER", "TEXT")
- Messages Executing: StdsmToStdsl I:GISDATA_ScriptingStdsmToStdsl.gdbForestRoads RDCLASS I:GISDATA_ScriptingStdsmToStdsl.gdbBufferDist RDCLASS I:GISDATA_ScriptingStdsmToStdsl.gdbstdsm I:GISDATA_ScriptingStdsmToStdsl.gdbForestRoads_Buffer Start Time: Fri Jun 02 15:10:53 2017 Running script StdsmToStdsl... Failed script StdsmToStdsl...
- Traceback (most recent call last): File "I:GISDATA_ScriptingStdsmToStdsl.py", line 17, in <module>
- arcpy.Buffer_analysis("infeatures_lyr", outFeatures, "DISTANCE") File "c:program files (x86)arcgisdesktop10.3arcpyarcpyanalysis.py", line 692, in Buffer
- raise e ExecuteError: ERROR 999999: Error executing function. Failed to execute (Buffer).
- Failed to execute (StdsmToStdsl). Failed at Fri Jun 02 15:23:59 2017 (Elapsed Time: 13 minutes 6 seconds)
- import arcpy
- arcpy.env.workspace = "I:/GISDATA/_Scripting/StdsmToStdsl.gdb"
- arcpy.Buffer_analysis("ForestRoads", "ForestRoadsBuffer", "DISTANCE", "FULL", "ROUND", "ALL")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement