Solved! Go to Solution.
import sys # arcpy environments and liscences from arcpy import env arcpy.CheckOutExtension("spatial") arcpy.CheckOutExtension("management") arcpy.env.overwriteOutput = True etc = Your Codewhich you can do by using the # sign at the top. If it is the same code then it would also be helpful to see more than one line at a time. Thanks!
So now I'm trying to remove buffered roads from the previously selected areas.
>>> # Remove the buffered roads from the suitable vegetation areas
>>> erase = arcpy.Erase_analysis(select, "buffer", "in_memory/erase")
Runtime error Traceback (most recent call last): File "<string>", line 1, in <module> File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\analysis.py", line 205, in Erase raise e ExecuteError: ERROR 000732: Input Features: Dataset in_memory\select does not exist or is not supported
So then I tried changing the buffer feature, but nothing doing
>>> erase = arcpy.Erase_analysis(select, buffer, "in_memory/erase")
Runtime error Traceback (most recent call last): File "<string>", line 1, in <module> File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\analysis.py", line 205, in Erase raise e ExecuteError: ERROR 000732: Input Features: Dataset in_memory\select does not exist or is not supported
What's strange is that when I selected the vegetation ArcMap created results for that but when I added the buffer code, ArcMap also added it to my list of layers (in addition to showing the results). Could someone help me understand what's going on here.
MakeFeatureLayer_management (in_features, out_layer, {where_clause}, {workspace}, {field_info}) ## this will make a feature layer that can be fed into the select tool if this where clause isn't sufficient SelectLayerByAttribute_management (out_layer, {selection_type}, {where_clause}) ## use the feature layer as input to the select tool. this puts the selection on the layer until removed or re-selected FeatureClassToFeatureClass_conversion (out_layer, "C:/output/temp.gdb", "in_features" {where_clause}) # if nothing fancy in your select, you could skip that and makefeature and include your where clause here ## in fact, all three support where clause, so if not switching selection, no need for selectlayertool Erase_analysis ("C:/output/temp.gdb/in_features", buffer, "in_memory/erase"), {cluster_tolerance}) ## use the FC created from the selected values to be erased from.