Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. import arcpy
  2. #Set join parameter variables
  3. 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
  4. 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
  5. 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
  6. 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
  7. arcpy.MakeFeatureLayer_management(inFeatures,"inFeatures_lyr") #make feature layer from feature class
  8. #Join road feature class to buffer distance table
  9. arcpy.JoinField_management("inFeatures_lyr", inField, joinTable, joinField)
  10. #Select roads that intersect the stdsm feature class
  11. stdsM = arcpy.GetParameterAsText(4) #this is a polygon feature class. It is a feature class data type in ArcGIS
  12. arcpy.MakeFeatureLayer_management(stdsM,"stdsM_lyr") #make feature layer from feature class
  13. arcpy.SelectLayerByLocation_management("inFeatures_lyr", "INTERSECT", "stdsM_lyr")
  14. #create output parameter and buffer roads
  15. 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
  16. arcpy.Buffer_analysis("infeatures_lyr", outFeatures, "DISTANCE")
  17. #Remove join from Roads
  18. arcpy.RemoveJoin_management("inFeatures_lyr")
  19. #Add identifying field to buffer layer and calculate a value
  20. arcpy.MakeFeatureLayer_management(outFeatures, "outFeatures_lyr")
  21. arcpy.AddField_management("outFeatures_lyr", "BUFFER", "TEXT")
  22.  
  23. 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...
  24.  
  25. Traceback (most recent call last): File "I:GISDATA_ScriptingStdsmToStdsl.py", line 17, in <module>
  26. arcpy.Buffer_analysis("infeatures_lyr", outFeatures, "DISTANCE") File "c:program files (x86)arcgisdesktop10.3arcpyarcpyanalysis.py", line 692, in Buffer
  27. raise e ExecuteError: ERROR 999999: Error executing function. Failed to execute (Buffer).
  28.  
  29.  
  30. Failed to execute (StdsmToStdsl). Failed at Fri Jun 02 15:23:59 2017 (Elapsed Time: 13 minutes 6 seconds)
  31.  
  32. import arcpy
  33. arcpy.env.workspace = "I:/GISDATA/_Scripting/StdsmToStdsl.gdb"
  34. arcpy.Buffer_analysis("ForestRoads", "ForestRoadsBuffer", "DISTANCE", "FULL", "ROUND", "ALL")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement