AnsweredAssumed Answered

10.7 Custom Toolbox; buffer tool error 000728: field <output features> does not exist within the table

Question asked by ian.boddie on Nov 10, 2019
Latest reply on Nov 11, 2019 by ian.boddie
import arcpy

arcpy.env.OverwriteOutput = True


class Toolbox(object):
    def __init__(self):

        self.label = "StreamAnalysisTools"
        self.alias = "DBGWetlandRestTools"

        # List of tool classes associated with this toolbox
        self.tools = [BufferExtract, SlopeAndStreamAnalysis]


class BufferExtract(object):
    def __init__(self):
        self.label = "1. Identify Study Area"
        self.description = "This tool uses a Streamlines Shapefile to create a buffer of 50m, " \
                           "then uses buffer Features to Extract by Mask from DEM Raster. "
        self.canRunInBackground = True

    def getParameterInfo(self):
        param0 = arcpy.Parameter(
            displayName="Input Stream Features",
            name="inStreams",
            datatype=["DEFeatureClass", "DEShapefile", "DeFeatureDataset", "DELayer"],
            parameterType="Required",
            direction="Input"
        )
        param1 = arcpy.Parameter(
            displayName="Input Buffer Distance",
            name="bufferDist",
            datatype="GPLinearUnit",
            parameterType="Required",
            direction="Input"
        )
        param1.value = 50

        param2 = arcpy.Parameter(
            displayName="Output Buffer Features",
            name="outBuffer",
            datatype="DEFeatureClass",
            parameterType="Required",
            direction="Output"
        )

        param3 = arcpy.Parameter(
            displayName="Input DEM Raster",
            name="inRaster",
            datatype="DERasterDataset",
            parameterType="Required",
            direction="Input"
        )

        param4 = arcpy.Parameter(
            displayName="Output Extracted Raster",
            name="outRaster",
            datatype="DERasterDataset",
            parameterType="Required",
            direction="Output"
        )

        params = [param0, param1, param2, param3, param4]
        return params

    def isLicensed(self):
        if arcpy.CheckExtension("Spatial") == "Available":
            return True
        else:
            return False

    def updateParameters(self, parameters):

        return

    def updateMessages(self, parameters):

        return

    def execute(self, parameters, messages):
        infeatures = parameters[0].valueAsText
        bufferdist = parameters[1].valueAsText
        outbuffer = parameters[2].valueAsText
        inraster = parameters[3].valueAsText
        outraster = parameters[4].valueAsText

        mask = arcpy.Buffer_analysis(infeatures, bufferdist, outbuffer)
        arcpy.gp.ExtractByMask_sa(inraster, mask, outraster)

        return



Here is my code segment. I can't figure out what is going wrong, but when I run this, it fails at the buffer stage and returns ERROR 000728: Field (buffer output file) does not exist within table

Outcomes