Skip to content

Instantly share code, notes, and snippets.

@gannebamm
Created April 21, 2017 10:57
Show Gist options
  • Save gannebamm/4b696fd40da330c38e935194b64092e9 to your computer and use it in GitHub Desktop.
Save gannebamm/4b696fd40da330c38e935194b64092e9 to your computer and use it in GitHub Desktop.
ZonalMetrics Tools snippet
#[ pyt stuff ...]
class MetricsCalcTool(object):
def __init__(self):
self.category = "ZonalMetrics"
self.label = "FILL ME IN SUBCLASS"
self.description = "FILL ME IN SUBCLASS"
self.canRunInBackground = True
self._temp_layers = []
self._temp_layer_nb = 1
def getParameterInfo(self):
inputArea = arcpy.Parameter(
displayName="Input layer",
name="in_area",
datatype="GPFeatureLayer",
#datatype="Feature Layer",
parameterType="Required",
direction="Input")
statLayer = arcpy.Parameter(
displayName="Statistical layer",
name="stat_layer",
datatype="GPFeatureLayer",
#datatype="Feature Layer",
parameterType="Required",
direction="Input")
out = arcpy.Parameter(
displayName="Output Feature",
name="out_feature",
datatype="DEFeatureClass",
#datatype="Feature Class",
parameterType="Derived",
direction="Output")
out.parameterDependencies = [statLayer.name]
out.schema.clone = True
classField = arcpy.Parameter(
displayName="Class Field",
name="class_field",
datatype="Field",
parameterType="Required",
direction="Input")
classField.parameterDependencies = [inputArea.name]
classList = arcpy.Parameter(
displayName="Classes",
name="class_list",
datatype="GPString",
#datatype="String",
parameterType="Optional",
direction="Input",
multiValue=True)
classList.parameterDependencies = [classField.name]
return [inputArea, statLayer, classField, classList, out]
#[ rest of the objects code ...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment